Definition:
In Oracle PL/SQL, POSITIVEN is a 32 bit sub datatype derived from BINARY_INTEGER in Oracle PL/SQL. It allows only not NULL positive integers. Therefore, the variable of POSITIVEN type must be declared with a default value.
Note that it is a PL/SQL number type and cannot be used in SQL.
Example Syntax:
VARIABLE [POSITIVE]
Example Usage:
The PL/SQL block below declares POSITIVEN variable and assigns NULL value to it. Oracle raises exception PLS-00218 as POSITIVEN variable does not allows NULL values.
DECLARE
L_NUM POSITIVEN;
BEGIN
L_NUM := NULL;
END;
/
L_NUM POSITIVEN;
*
ERROR at line 2:
ORA-06550: line 2, column 9:
PLS-00218: a variable declared NOT NULL must have an initialization assignment
ORA-06550: line 4, column 12:
PLS-00382: expression is of wrong type
ORA-06550: line 4, column 3:
PL/SQL: Statement ignored
The PL/SQL block below declares POSITIVEN variable. Note the default value assigned during declaration.
DECLARE
L_NUM POSITIVEN := 1;
BEGIN
L_NUM := 100;
END;
/
PL/SQL procedure successfully completed.