ORACLE 11g introduced the
SIMPLE_INTEGER data type, which is a sub-type of
PLS_INTEGER, and covers the same range. There
are three main differences between the two types:
SIMPLE_INTEGER is always
NOT NULL. So when the value of the declared variable is never going to be null, you can
declare it as
- You will never face a numeric overflow using
SIMPLE_INTEGER because this data type wraps around without giving any error.
SIMPLE_INTEGER data type gives a major performance boost over
PLS_INTEGER when the code is compiled in "NATIVE"
mode, because arithmetic operations on
SIMPLE_INTEGER type are performed directly at the hardware level.
Noncompliant Code Example
v1 PLS_INTEGER; -- Noncompliant
v1 SIMPLE_INTEGER := 42;