Monday, 4 June 2018

Nested Table

Nested table we can create in db level, please check the below example

Steps1:
CREATE TYPE TYPE_NAME AS TABLE OF VARCHAR2(30);
Steps2:
CREATE TABLE nested_tbl (ID NUMBER,col1 type_name)
NESTED TABLE col1 STORE AS colmn1_tab;
Steps3:
SELECT * FROM NESTED_TBL;
Steps4:
begin
INSERT INTO nested_tbl VALUES (1, type_name('A'));
INSERT INTO nested_tbl VALUES (2, type_name('B', 'C'));
INSERT INTO nested_tbl VALUES (3, type_name('D', 'E', 'F'));
COMMIT;
end;
Steps5:
SELECT * FROM nested_tbl;
SELECT id, COLUMN_VALUE FROM nested_tbl t1, TABLE(t1.col1) t2;




No comments:

Post a Comment