Composite Data Types





Objects of type TABLE are called PL/SQL tables. PL/SQL tables use a primary key to give you array like access to rows. Like the size of a database table, the size of a size of a PL/SQL table is unconstrained.
PL/SQL tables must be declared in two steps. First you define a TABLE type, then PL/SQL tables of that type. It can be declared in the declarative part of any block, subprogram or package with the syntax as follows:
TYPE- type name IS TABLE OF {column-type1 variable %type} [not null] INDEX BY BINARY INTEGER where type-name is a type specifier used in subsequent declarations of PL/SQL tables and column type is any scalar datatype such as CHAR. DATE OF NUMBER. You can use the % type attribute to specify a column datatype.
To reference rows in a PL/SQL table, you use a array like syntax.
plsql_table_name. (primary_key_value)
where primary_key_value belongs to type BINARY-INTEGER.
To reference the third row we use ename-tab(3)
You must use a loop to insert into a database column. Likewise you must a loop to fetch values from a database column into a PL/SQL table. You cant reference a table in the INTO clause. There is no straight forward way to delete rows from a. PL/SQL table.
Domain Name Search
|