PL/SQL Tutorial

PL/SQL Datatypes: Scalar, Composite, Reference and LOB

PL/SQL Datatypes

PL/SQL DATATYPES

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 :

  1. Scalar data types: Scalar data types haven’t internal components.
  2. Composite data types: Composite data types have internal components to manipulate data easily.
  3. Reference data types: This data types works like a pointer to hold some value.
  4. LOB data types: Stores large objects such as images, graphics, video.

Scalar datatypes

Scalar data type haven’t internal components. It is like a linear data type.

Scales data type divides into four different types:

  • Character
  • Numeric
  • Boolean
  • Date

Character datatype

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

Leave a Reply