Prepare an SQL script demo. SQL
Set serveroutput on
Declare
V_name dept. dname % type;
Begin
Select dname into v_name from dept where deptno = & 1;
Dbms_output.put_line ('department name is: '| v_name );
End;
/
Exit;
Then run the following command on the terminal:
Sqlplus "scott/tiger @ orcl" @ demo. SQL 20
Return Value:
SQL * Plus: Release 9.2.0.4.0-Production on Thu Oct 17 21:37:28 2013
Copyright (c) 1982,200 2, Oracle Corporation. All rights reserved.
Connected:
Oracle9i Enterprise Edition Release 9.2.0.4.0-Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0-Production
Old 4: select dname into v_name from dept where deptno = & 1;
New 4: select dname into v_name from dept where deptno = 20;
Department name is: RESEARCH
PL/SQL procedure successfully completed.
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0-Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0-Production
Note: parameters such as & 1, & 2 can be passed to the script.