Pages

Pages

PL/SQL Tables.

PL/SQL Tables:
  • PL/SQL tables are temporary array-like objects used in a PL/SQL Block.
  • They are modelled as database tables, but are not same.
  • PL/SQL tables are very dynamic in operation, giving the simulation to pointers in ‘C’ language.
  • PL/SQL TABLES use a “PRIMARY KEY” to give array like access to rows.
  • PL/SQL table can be declared in the declarative part of any block. Subprogram or package.
  • It is similar to an array in Third generation language.
  • PL/SQL table should contain two components.
  • A “PRIMARY KEY” of data type BINARY_INTEGER, that indexes the PL/SQL table.
  • A column of a scalar or Record data type which stores the PL/SQL  table elements.
  • PL/SQL table can increase in size dynamically as they are unconstrainted.
  • A PL/SQL TABLE must be declare in two steps.
1)First we define a table type. 
2)We declare a variable of PL/SQL table as data type.
Syntax:
TYPE<Type name> IS TABLE OF 
{column type OR Table.column%TYPE OR PL/SQL RECORD} 
INDEX BY BINARY_INTEGER;
  • The number of rows in PL/SQL table can increase dynamically, hence a PL/SQL table can grow as new rows are added.

No comments:

Post a Comment