Create user type with map
SQL>
SQL> create or replace
2 type person as object(
3 first_name varchar2(100),
4 last_name varchar2(100) )
5 /
Type created.
SQL>
SQL>
SQL>
SQL> alter type person
2 add attribute dob date
3 cascade not including table data
4 /
Type altered.
SQL>
SQL> create or replace
2 type employee as object(
3 name person,
4 empno number,
5 hiredate date,
6 sal number,
7 commission number,
8 map member function convert return number )
9 /
Type created.
SQL>
SQL> create or replace
2 type body employee as
3 map member function convert return number is
4 begin
5 return self.empno;
6 end;
7 end;
8 /
Type body created.
SQL>
SQL> drop type employee;
Type dropped.
SQL> drop type person;
Type dropped.
SQL>
SQL>
Related examples in the same category