In Oracle PL/SQL, a PL/SQL record can be declared using the ROWTYPE specifier, which can be thought of as being analogous to a row in the database table. A record declared using TABLE%ROWTYPE carries the same structure, including names and data type as that of a logical record of the table. Note that the attributes do not inherit the constraints on the columns of the database table.
ROWTYPE can also be used with explicit cursors to declare Cursor Variables.
[RECORD NAME] TABLE%ROWTYPE
The Pl/SQL block below declares a record "L_REC" which includes all columns of the EMPLOYEE table as attributes. It can contain a row from the EMPLOYEE table.
WHERE EMPNO = 100;
FETCH C1 INTO L_REC;
Related Code Snippets:
- Alias and RowType - This block finds all employees whose monthly wages (salary plus commission) ar...