I have attached the image with the SQL queries which are mentioned in Oracle documentation of Nested Tables and how to access the entries from the tables. But I cannot understand the SELECT statements used in there. Can someone explain me the actual meaning of the SELECT query used in there?Screenshot of Oracle SQL documentation on Nested Tables
Create a table with NESTED TABLE column,
CREATE OR REPLACE TYPE my_tab_t AS TABLE OF VARCHAR2(30);
/
CREATE TABLE nested_table (id NUMBER, col1 my_tab_t)
NESTED TABLE col1 STORE AS col1_tab;
Insert data into table,
INSERT INTO nested_table VALUES (1, my_tab_t('A'));
INSERT INTO nested_table VALUES (2, my_tab_t('B', 'C'));
INSERT INTO nested_table VALUES (3, my_tab_t('D', 'E', 'F'));
COMMIT;
The SQL query that I couldn't get,
SELECT id, COLUMN_VALUE FROM nested_table t1, TABLE(t1.col1) t2;
The result is displayed as,
ID COLUMN_VALUE
1 A
2 B
2 C
3 D
3 E
3 F
6 rows selected.
Syntax
FROM nested_table t1, TABLE(t1.col1) t2
is the old Oracle syntax for a CROSS JOIN, you should not use it nowadays. Better writeCROSS JOIN means, you combine each row from
t1
with each row fromt2
. You should find many explanations in the internet.