I written a command in batch file which calls a .sql file which contains a pl/sql procedure. But I need to set the a parameter in PL/SQL procedure which common throughout the procedure from the batch file.
The batch file is as below.
set parameterOne=%1
set parameterTwo=%2
sqlplus -s uid/pwd filepath/filename.sql %parameterOne %parameterTwo
And the PL/SQL procedure in .sql file is as follow.
DECLARE parameterOneValue INT;
parameterTwoValue INT;
BEGIN
parameterOneValue := $(parameterOne);
parameterTwoValue := $(parameterTwo);
//procedure block
END;
I need to set the parameterOne
, parameterTwo
attribute from batch file to parameterOneValue
, parameterTwoValue
in .sql files respectively. Could anyone provide solution to this?
Use SET DEFINE ON , and use &
for variable substitution.
For example,
Your batch file:
set parameterOne=%1
set parameterTwo=%2
sqlplus -s uid/pwd filepath/filename.sql %parameterOne %parameterTwo
SQL*Plus substitution in PL/SQL block:
parameterOneValue := &1;
parameterTwoValue := &2;
&
will substitute the actual value that you set in the batch file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.