Wednesday, May 14, 2014

Inserting Data into Array Type


 

Creating Type Object

create type project_type as object
(
name varchar2(50),
role varchar2(20)
);

 

Creating Type Array

create type projectlist as VARRAY2(5) of project_Type;
commit;

 

Creating table with array type

create table emp
(   empno         number(5),
    ename         varchar2(30),
    projects     projectlist
);

Inserting data in to varray

insert into emp
 values(1,'Ellison', projectlist(
                                    project_type('Telephone Billing', 'System Analyst'),
                                    project_type('Housing Loans','Oracle DBA')
                                )
        );


select * from emp where empno = 1;

DROP TYPE project_type;
DROP TYPE projectlist;
DROP TABLE emp;

No comments:

Post a Comment