What are nested table?
Ø A
table inside a table or a table embedded with another table known as nested
table.
Definition of nested table:
Ø Nested
table are one dimensional structure which are persistent and unbounded in
nature.
Ø They
are accessible in SQL and PL/SQL and can be used in tables, records and object
definitions. Since it is an unbounded PL/SQL collection hence it can hold any
number of elements in an unordered set.
Syntax:
Creating Nested table:
Declare
Type
nested_table_name is table of
element_type [ NOT NULL];
Explanation:
v We should create nested table in DECLARATION section.
v To
create nested table we use TYPE statement which is followed by the TYPE
keyword.
v NESTED_TABLE_NAME
is the Name of your Nested table which is user defined.
v IS
TABLE OF resource free and followed by ELEMENT_TYPE.
v ELEMENT_TYPE
should to be primitive data type or user defined data type.
Example: 1
Output:
Example: 2
Output:
Example: 3
Output:
No comments:
Post a Comment