You are on page 1of 1

CREATE TYPE dept_tab IS TABLE OF VARCHAR2(50);

/
CREATE TABLE Department (
DEPTNO
NUMBER,
SECTION
VARCHAR2(30),
dept_name_tab dept_tab)
NESTED TABLE dept_name_tab STORE AS names_table;
/
--Insert a record into Department, with a Nested Table of dept names.
INSERT INTO Department (DEPTNO, SECTION, dept_name_tab)
VALUES (DEPTNO_SEQ.NEXTVAL,'Engineering',
dept_tab('Electronics','Computer', _
'Instrumentation', 'Information technology'));
/
--Declare a nested table type
DECLARE
DeptName_tab dept_tab;
BEGIN
DeptName_tab :=
dept_tab ('Mechanical',''Electronics', 'Computer', 'Instrumentation',
''Information technology','Production', ELECTRICAL );
--Update the existing record with a new dept names Nested Table.
UPDATE Department
SET dept_name_tab = DeptName_tab;
END;
/

You might also like