PL/SQL data type

PL/SQL data type

PL/SQL data type: PL/SQL supports the standard ORACLE SQL data types. The default PL/SQL data types that can be declared in PL/SQL are:
  1. PL/SQL NUMBER:  For storing numeric data
Syntax: variable name NUMBER (precision, [scale]) precision determines the number of significant digits that NUMBER can contain. Scale determines the number of digits to the right of the decimal point.
Example: NUMBER (4, 2) stores 4234.60
NUMBER (10) stores 5678435678


This PL/SQL data type stores fixed length character data.

Syntax: Variable name CHAR (size).
Where size specifies fixed length of the variable name.
Example: CHAR (10) stores   MASTERFILE

3.PL/SQL Varchar2:

It stores variable length character string data.

Syntax: Variable name VARCHAR2 (size).
Where size specifies the maximum length of the variable name.


The date data types store a date and time.

Syntax: variable name DATE
Example: date_of_birth DATE


This data type stores only TRUE, FALSE or NULL values.

Syntax: variable name BOOEAN
Example: flag BOOLEAN.


Declares a variable or constant to have the same PL/SQL data type as data type as that of a previously defined variable or of a column in a table or in a view.


 NOT NULL causes creation of a variable or a constant that cannot have a NULL value. Assigning the value NULL to a variable or a constant, that has been assigned a NOT NULL constant, cause an error.
NOTE: as soon as a variable or constant has been declared as NOT NULL, it must be assigned a value. Hence every NOT NULL declaration of variable or constant needs to be followed by PL/SQL expression that loads a value into the variable or constant declared.

Leave a Reply

Your email address will not be published.