How to Initialize Variable in PL/SQL
In this article I am going to explain how to initialize variable in PL/SQL.
PL/SQL is define as procedure language/structure query language. PL/SQL is developed by oracle. PL/SQL supports many feature like variables, loops, conditions and exceptions. It also support the concept of array. In present time PL/SQL is integrated component of oracle software. SQL provide limited support for advance programming and PL/SQL fill this gap.
Block is a basic unit of a PL/SQL application. This block is collection of PL/SQL statements grouped as logical unit. Using PL/SQL blocks you can create five different type of program units.
- Stored Function
- Stored procedure
- Anonymous Block
Syntax for declaring a variable in PL/SQL
Syntax for Initializing a variable in PL/SQL
Varriable_Name := Value;
Varriable_Name DataType := Value;
Here Variable_Name is name of variable and DataType is a valid data type.
st_id CONSTANT NUMBER(10) := 2;
SELECT s_marks into st_marks FROM student WHERE s_id=st_id;