Previous |
Next |
Every PL/SQL constant, variable, subprogram parameter, and function return value has a data type that determines its storage format, constraints, valid range of values, and operations that can be performed on it.
A PL/SQL data type is either a SQL data type (such as VARCHAR2
, NUMBER
, and DATE
) or a PL/SQL-only data type. The latter include BOOLEAN
, RECORD
, REF
CURSOR
, and many predefined subtypes. PL/SQL also lets you define your own subtypes.
A subtype is a subset of another data type, which is called its base type. A subtype has the same valid operations as its base type, but only a subset of its valid values. Subtypes can increase reliability, provide compatibility with ANSI/ISO types, and improve readability by indicating the intended use of constants and variables.
The predefined numeric subtype PLS_INTEGER
is especially useful, because its operations use hardware arithmetic, rather than the library arithmetic that its base type uses.
You cannot use PL/SQL-only data types at schema level (that is, in tables or standalone stored subprograms). Therefore, to use them in a stored subprogram, you must put the subprogram in a package.
Oracle Database PL/SQL Language Reference for general information about PL/SQL data types
Oracle Database PL/SQL Language Reference for information about the PLS_INTEGER
data type