There are two types of datatypes in PL/SQL:
- Scalar datatypes Example are NUMBER, VARCHAR2, DATE, CHAR, LONG, BOOLEAN etc.
- Composite datatypes Example are RECORD, TABLE etc.
PL/SQL (Procedural Language/Structured Query Language) is an extension of SQL that is used to integrate procedural constructs with SQL statements. In PL/SQL, there are several data types available. Some of the common data types include:
- Scalar Data Types:
- NUMBER: Used for numeric data.
- VARCHAR2/CHAR: Used for character strings.
- DATE: Used for date and time values.
- BOOLEAN: Used for Boolean values (TRUE, FALSE, or NULL).
- Composite Data Types:
- RECORD: Used to hold related data items.
- TABLE: Used to hold an indexed collection of data elements.
- VARRAY: Variable-size arrays.
- Nested Table: Unbounded array.
- Reference Data Types:
- REF CURSOR: Used for returning result sets from stored procedures or functions.
- REF: Used for creating a reference to an instance of an object type.
- LOB Data Types:
- CLOB (Character Large Object): Used for large blocks of character data.
- BLOB (Binary Large Object): Used for large blocks of binary data.
- Other Data Types:
- BINARY_INTEGER: Used for integer values.
- PLS_INTEGER: Similar to BINARY_INTEGER but has implementation-specific characteristics.
- BOOLEAN: Represents TRUE, FALSE, or NULL.
It’s essential to note that the specific data types available in PL/SQL may vary depending on the Oracle Database version. Always refer to the documentation corresponding to your database version for the most accurate and up-to-date information.