Oracle PL/SQL Varrays

These can be stored in the columns of your tables. When you create them you must provide the maximum size for them. These are dense and Not sparse, which means there is no way to delete individual elements of a varrays

Example:

Create type project_work_type as varray(20) of varchar2(30);

Create table student_projects(

Name varchar2(20),

Id number,

--each student can have upto 20 projects

Projects project_work_type,

);

Example:

Create type emp_type as object(

Id number,

Name varchar2(20)

);

Create type emp_varray_type as varray(5) of emp_type;

Create table t1(

T1_id number,

T1_name varchar2(10),

Employee emp_varray_type);

Insert into t1(t1_id, t1_name, employee)

Values (1, ’one’,emp_varray_type( emp_type(1,’a’),

Emp_type(2,’b’))

)

Recent Tutorials