Professional Documents
Culture Documents
Oracle Advanced PLSQL Concepts Collections
Oracle Advanced PLSQL Concepts Collections
Pune
What we cover ?
Ref Cursors
Collections
Collections
A collection is a composite type which combines variables of the same type as a
single unit.
Similar to a C or Java Array. There are 3 collection types:
-Index by tables -Nested Tables -Varrays
PLSQL Tables
Index by tables and nested tables are collectively known as PLSQL tables.
Index by Tables
To declare a Index by table, we first declare a table type in a PLSQL block and
Nested Tables
Same as index by tables.
Nested tables must be created with sequential keys, and the keys cannot be
negative. Syntax: TYPE table_name is TABLE OF table_type [NOT NULL] If NOT NULL is present,elements of the nested table cannot be null Nested table needs to be initialized. Initialization is done using Constructor. The constructor of nested table will have the same name as of table type itself. However, it can have varying number of
arguments.
The arguments become elements of the table starting sequentially with index 1.
V Arrays(Variable Arrays)
V array has a fixed upper bound on its size, specified as a part of the declaration.