What is PL/SQL Records Data Types

By | December 11, 2017

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.

  • Title
  • Author
  • Subject
  • ISBN NO
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;
Cursor-Based

Topic Related Interview Question :

Leave a Reply

Your email address will not be published. Required fields are marked *