What is a table of records?
What will be an ideal response?
The PL/SQL table type is declared with a data type. You may use a record type as a
table’s data type. The %ROWTYPE declaration attribute can be used to define the record
type. When a table is based on a record, the record must consist of fields with scalar data
types. The record must not have a nested record in it. The following examples show
different ways to declare table types based on records:
A PL/SQL table type based on a programmer-defined record:
TYPE student_record_type IS
RECORD (stu_id NUMBER (3), stu_name VARCHAR2 (30));
TYPE student_table_type IS TABLE OF student_record_type
INDEX BY BINARY_INTEGER;
Student_table student_table_type;
A PL/SQL table type based on a database table:
TYPE employee_table_type IS TABLE OF employee%ROWTYPE
INDEX BY BINARY_INTEGER;
Employee_table employee_table_type;
A PL/SQL table type based on a row returned by a cursor:
CURSOR employee_cur IS SELECT * FROM employee;
TYPE employee_cur_table_type IS employee_cur%ROWTYPE
INDEX BY BINARY_INTEGER;
Employee_cur_table employee_cur_table_type;
You might also like to view...
Which kind of monitor uses a liquid crystal display to produce images on the screen?
A. LCD B. CRT C. PDA D. stylus
____ is another term for document properties.
A. Metadata B. Key terms C. Enhanced text D. Indices