Creating a Table with a Varray Column
DROP TABLE
dept_projects
CASCADE CONSTRAINTS PURGE;
DROP type projectlist;
-- Each project has a 16-character code name.
-- We will store up to 50 projects at a time in a database column.
CREATE TYPE projectlist AS VARRAY(50) OF VARCHAR2(16);
/
CREATE TABLE dept_projects ( -- create database table
dept_id NUMBER(2),
NAME VARCHAR2(15),
budget NUMBER(11,2),
-- Each department can have up to 50 projects.
projects PROJECTLIST);
Varray Constructor Within a SQL Statement
BEGIN
INSERT INTO dept_projects
VALUES (60,
'Security',
750400,
Projectlist('New Badges','Track Computers','Check Exits'));
END;
/
nice info ..
this is the first time that I knew that array can be used in oracle
but I tried to aplly an insert statement but don't know how it should be
insert into dept_projects(dept_id,NAME,budget,projects(0)) values ('a1','h1n1',21,'project1');
Hello HRS123,
Read this Page to learn more about VARRAY datatype:
http://www.orafaq.com/wiki/VARRAY
have a nice day