Showing posts with label Oracle/PLSQL: Declaring Variables. Show all posts
Showing posts with label Oracle/PLSQL: Declaring Variables. Show all posts

Sunday, January 11, 2009

Oracle/PLSQL: Declaring Variables

The syntax for declaring variables is:

variable_name [CONSTANT] datatype [NOT NULL] [:= | DEFAULT initial_value]


For example:

Declaring a variable:

LDescription varchar2(40);


Declaring a constant:

LTotal CONSTANT numeric(8,1) := 8363934.1;


Declaring a variable with an initial value (not a constant):

LType varchar2(10) := 'Example';