Table of user-defined types : Table of Type « Collections « Oracle PL/SQL Tutorial






SQL> CREATE TYPE SKILL_TYPE  AS OBJECT (
  2    SKILL_ID NUMBER(7,0),
  3    SKILL_NAME VARCHAR2(20),
  4    SKILL_DESC VARCHAR2(100)
  5    );
  6  /

Type created.

SQL>
SQL> CREATE TYPE SKILL_TABLE_TYPE AS TABLE OF SKILL_TYPE;
  2  /

Type created.

SQL>
SQL> DECLARE
  2    SKILL_TABLE    SKILL_TABLE_TYPE;
  3  BEGIN
  4    SKILL_TABLE := SKILL_TABLE_TYPE();
  5    SKILL_TABLE.EXTEND(5);
  6    SKILL_TABLE(1) := SKILL_TYPE(100,'ROLLERBLADING','REQUIRED FOR TAPE MOUNTING') ;
  7    SKILL_TABLE(2) := SKILL_TYPE(101,'NINTENDO','USAF - CLASSIFIED') ;
  8    SKILL_TABLE(3) := SKILL_TYPE(102,'KARATE','MANAGEMENT TRAINING') ;
  9  END;
 10  /

PL/SQL procedure successfully completed.

SQL>
SQL> DROP TYPE SKILL_TYPE FORCE;

Type dropped.

SQL> DROP TYPE SKILL_TABLE_TYPE;

Type dropped.








26.26.Table of Type
26.26.1.Table of type
26.26.2.Use of PL/SQL tables of types
26.26.3.Use LOOP to output all elements in a table collection
26.26.4.Forall in value of table of type
26.26.5.Table of user-defined types
26.26.6.Select user-defined type into table collection of user-defined types