Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle PL/SQL POSITIVEN Datatype      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: POSITIVEN

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.
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 134 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?