create TYPE t_preamoug as OBJECT (
dlina number,
shirina number,
MAP member function aria return number
);
create or replace TYPE body t_preamoug as
MAP member function aria return number is
begin
return dlina*shirina;
end aria;
end;
create table preamoug of t_preamoug;
INSERT into preamoug VALUES (t_preamoug(10,20));
INSERT into preamoug VALUES (t_preamoug(30,40));
select * from preamoug;
select P.dlina from preamoug P;
select VALUE(P) from preamoug P;
select * from preamoug P order by P.dlina ASC;
select P.aria() from preamoug P order by P.dlina DESC;
DECLARE
d1 t_preamoug:=t_preamoug(12,45);
d2 t_preamoug:=t_preamoug(32,6);
BEGIN
if d1>d2 then DBMS_OUTPUT.PUT_LINE ('Perviy bolishe vtorogo' ||' ' ||d1.aria);
END if;
end;