CREATE TYPE Rectangle_type AS OBJECT ( length NUMBER, width NUMBER, MAP MEMBER FUNCTION area RETURN NUMBER ); CREATE TYPE BODY Rectangle_type AS MAP MEMBER FUNCTION area RETURN NUMBER IS BEGIN RETURN length * width; END area; END; CREATE TABLE rectangles OF Rectangle_type; INSERT INTO rectangles VALUES (1,2); INSERT INTO rectangles VALUES (2,1); INSERT INTO rectangles VALUES (2,2); SELECT DISTINCT VALUE(r) FROM rectangles r;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter