A PL/SQL record is a composite data structure that is a group of related data stored in fields. Records are composed of a group of fields, similar to the columns in a row . The %ROWTYPE attribute lets you declare a PL/SQL recordthat represents a row in a database table, without listing all the columns.
- PLSQL handle three type of Records
- 1)User- Define
- 2)Table -based
- 3)Cursor- Based
User Define Records
Example : Suppose you want to keep track of your books in a library.
Table –Based Records Data Types
set serveroutput on; DECLARE employee_rec Employees%ROWTYPE; BEGIN select * into employee_rec from EMployees where employee_id=101; dbms_output.put_line('Employee ID: ' || employee_rec.first_name); dbms_output.put_line('Employee Salary: ' || employee_rec.salary); END;
Topic Related Interview Question :