A variable in any programming language is the name of space where values are stored and controlled by our code/program
- We can not use reserve keyword as a variable name
- Variable length should not exceed 30 characters
- The variable name consists of letters followed by other letters, dollar sign, underscore and numerals
- The variable name should be clear and easy to understand
Here we'll learn how to declare and initialize variables in PL/SQL
The basic syntax for declaring a variable in PL/SQL is following
variable_name [CONSTANT] datatype [NOT NULL] [:= | DEFAULT initial_value]
Here variable_name is the identifier of variable and datatype is a valid PL/SQL datatype. CONSTANT and DEFAULT are keywords used to define constants and set default values of variables