I
Insight Horizon Media

What are the types of variables use in PL SQL?

Author

Rachel Hickman

Published Mar 19, 2026

What are the types of variables use in PL SQL?

A wide range of data types are supported and can be used to declare variables in a PL/SQL block….Data types (PL/SQL)

PL/SQL data typeDB2® SQL data typeDescription
INTEGERINTEGERSigned four-byte integer numeric data
LONGCLOB (32760)Character large object data

What is type in Oracle with example?

For example, an object type can represent a student, bank account, computer screen, rational number, or data structure such as a queue, stack, or list. Currently, you cannot define object types in a PL/SQL block, subprogram, or package. You can define them interactively in SQL*Plus using the SQL statement CREATE TYPE .

What is type attribute in PL SQL?

The %TYPE attribute, used in PL/SQL variable and parameter declarations, is supported by the data server. Use of this attribute ensures that type compatibility between table columns and PL/SQL variables is maintained. The data type of this column or variable is assigned to the variable being declared.

How do you declare a variable of a table in PL SQL?

Declare TABLE TYPE variables in a PL/SQL declare block. Table variables are also known as index-by table or array. The table variable contains one column which must be a scalar or record datatype plus a primary key of type BINARY_INTEGER.

How many types of variables are there in Oracle?

Table 5-1 Summary of Oracle Built-In Datatypes

DatatypeDescription
BLOBUnstructured binary data.
BFILEBinary data stored in an external file.
RAW (size)Variable-length raw binary data.
LONG RAWVariable-length raw binary data.

What are PL SQL variables?

A variable is a meaningful name which facilitates a programmer to store data temporarily during the execution of code. It is nothing except a name given to a storage area. Each variable in the PL/SQL has a specific data type which defines the size and layout of the variable’s memory.

What is type in Oracle PL SQL?

The %TYPE attribute lets use the datatype of a field, record, nested table, database column, or variable in your own declarations, rather than hardcoding the type names. You can use the %TYPE attribute as a datatype specifier when declaring constants, variables, fields, and parameters.

What is object type in Oracle PL SQL?

PL/SQL allows defining an object type, which helps in designing object-oriented database in Oracle. An object type allows you to create composite types. Using objects allow you to implement real world objects with specific structure of data and methods for operating it. Objects have attributes and methods.

What is type and Rowtype in Oracle?

The %ROWTYPE attribute provides a record type that represents a row in a database table. The record can store an entire row of data selected from the table or fetched from a cursor or cursor variable. Variables declared using %ROWTYPE are treated like those declared using a datatype name.

What is the difference between type and Rowtype in PL SQL?

%TYPE : Used to declare a field with the same type as that of a specified table’s column. %ROWTYPE: Used to declare a record with the same types as found in the specified table, view or cursor (= multiple columns).

What are bind variables in PL SQL?

Bind variables are variables you create in SQL*Plus and then reference in PL/SQL. If you create a bind variable in SQL*Plus, you can use the variable as you would a declared variable in your PL/SQL subprogram and then access the variable from SQL*Plus.

What are Oracle variables?

What is a variable in Oracle? In Oracle/PLSQL, a variable allows a programmer to store data temporarily during the execution of code.