-- Reference : as a guidline to create OBJECT type table -- Please review the original document for more clarity. -- http://docs.oracle.com/cd/B19306_01/appdev.102/b14260/adobjint.htm#CHDFBGII CREATE TYPE person_typ AS OBJECT ( idno NUMBER, first_name VARCHAR2(20), last_name VARCHAR2(25), email VARCHAR2(25), phone VARCHAR2(20), MAP MEMBER FUNCTION get_idno RETURN NUMBER, MEMBER PROCEDURE display_details ( SELF IN OUT NOCOPY person_typ )); / CREATE TYPE BODY person_typ AS MAP MEMBER FUNCTION get_idno RETURN NUMBER IS BEGIN RETURN idno; END; MEMBER PROCEDURE display_details ( SELF IN OUT NOCOPY person_typ ) IS BEGIN -- use the PUT_LINE procedure of the DBMS_OUTPUT package to display details DBMS_OUTPUT.PUT_LINE(TO_CHAR(idno) || ' ' || first_name || ' ' || last_name); DBMS_OUTPUT.PUT_LINE(email || ' ' || phone); END; END; -------------------------------------- Example 1-2 Creating the contacts Table with an Object Type Column CREATE TABLE contacts ( contact person_typ, contact_date DATE ); INSERT INTO contacts VALUES ( person_typ (65, 'Verna', 'Mills', 'vmills@oracle.com', '1-800-555-4412'), '24 Jun 2003' ); ----------------- Example 1-3 Using the get_idno Object Method SELECT c.contact.get_idno() FROM contacts c; ----- object table starts ------ CREATE TABLE person_obj_table OF person_typ; INSERT INTO person_obj_table VALUES ( person_typ(101, 'John', 'Smith', 'jsmith@oracle.com', '1-800-555-1212') ); SELECT VALUE(p) FROM person_obj_table p WHERE p.last_name = 'Smith'; DECLARE person person_typ; BEGIN -- PL/SQL block for selecting a person and displaying details SELECT VALUE(p) INTO person FROM person_obj_table p WHERE p.idno = 101; person.display_details(); END; / --------------object table example ends-----