Quick Search:
 
 The Oracle PL/SQL ROWTYPE Keyword      [Return To Index] Jump to:  

Term: ROWTYPE

Definition:
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.

Example Syntax:

[RECORD NAME]  TABLE%ROWTYPE


Example Usage:

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.

DECLARE
L_REC EMPLOYEE%ROWTYPE;
CURSOR C1
IS
SELECT *
FROM EMPLOYEE
WHERE EMPNO = 100;
BEGIN
OPEN C1;
FETCH C1 INTO L_REC;
CLOSE C1;
END;



Related Links:

Related Code Snippets:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org