
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;
/
