Create the Bind Variables:
SQLPLUS sys as sysdba
SQL> variable var number
Assign the value to Bind Variable:
SQL> begin
2 :var := 100;
3 end;
4 /
Show Bind Variable value:
SQL> print var
var
------
100
use of bind variable in sql query:
SQL> select employee_id,first_name from hr.employees where department_id = :var;
EMPLOYEE_ID FIRST_NAME
----------- -------------------
108 Nancy
109 Daniel
110 John
111 Ismael
112 Jose Manuel
113 Luis