Thursday , November 21 2024

Oracle PL/SQL Records

This article contains information about Oracle PL/SQL Records such as Table Based, Cursor Based and User Defined Records.

What is Record in Oracle?

Data types such as NUMBER, VARCHAR, VARCHAR2 in Oracle PL / SQL are used to store a single data.

However, defining multiple variables related to each other makes the codes complicated.

Record is a Composite data type used to store more than one value in a single variable.

Record Type in Oracle

Record data type definition can be table-based, cursor-based and user-defined.

Table Based Records in Oracle PL/SQL

In this type of definition, Record definition is made by using TABLE_NAME% ROWDTYPE structure.

In the example below, a record data type named PERSON has been created using some columns in the contacts table.

Cursor Based Records in Oracle PL/SQL

In this type of definition, the fields defined with Cursor are taken with CURSOR_NAME% ROWDTYPE and a record is defined.

In the example below, the record data type named PERSON was created using the columns indicated by the LIST_TABLE cursor.

User Defined Records in Oracle PL/SQL

In this type of definition, the variables to be included in the record are defined using the TYPE keyword.

Record Example in Oracle PL/SQL

In the example below, using the TYPE keyword, we have defined a Record named PERSON, which contains the values of first_name, last_name, email, phone.

Record data types previously defined in the user-defined record can also be used. Another important feature of the Record data type is that it can pass parameters to structures that take parameters such as procedure and function. In this way, related parameters can be grouped and processed with a single record.

You can find more detailed information about below topics in the below link.

PL/SQL Tutorial

You will find below topics in this article.

  1. What is PL/SQL
  2. Oracle PL/SQL Data Types and Variables and Literals
  3. Oracle PL/SQL Operators
  4. Oracle PL/SQL Conditional Statements
  5. Oracle PL/SQL Loops
  6. Oracle PL/SQL Procedures and Procedure Parameters
  7. Oracle PL/SQL Functions
  8. Oracle PL/SQL Cursor
  9. Oracle PL/SQL Records
  10. Oracle PL/SQL Exception
  11. Oracle PL/SQL Trigger
  12. Oracle PL/SQL Packages
  13. Oracle PL/SQL Collections

You can find more information about records at docs.oracle.com

Loading

About Yusuf SEZER

Leave a Reply

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