The PL/SQL variables, constants and parameters must have a valid data type, which specifies a storage format, constraints, and a valid range of values. Here in this tutorial you will learn about PL/SQL Datatypes.
There are four built-in PL/SQL Datatypes :
- Scalar data types: Scalar data types haven’t internal components.
- Composite data types: Composite data types have internal components to manipulate data easily.
- Reference data types: This data types works like a pointer to hold some value.
- LOB data types: Stores large objects such as images, graphics, video.
Scalar data type haven’t internal components. It is like a linear data type.
Scales data type divides into four different types:
This data type basically stores alphanumeric characters in string format.
The literal values should always be enclosed between single quotes while assigning them to CHARACTER data type.
Following table shows some character data types in PL/SQL:
Numeric Data types in PL/SQL
Boolean Data types in PL/SQL
Boolean Data types are used to logical values either TRUE or FALSE.
Let’s see Boolean data types in PL/SQL:
Date/Time Data types in PL/SQL
Used to hold date and time variables in PL/SQL. PL/SQL automatically converts character value in to default date format (‘DD-MM-YY’) value. Below are date and time datatypes in PL/SQL:
Interval data types in PL/SQL