How to pass unix declared variable into SQL and PL SQL block [message #644711] |
Sun, 15 November 2015 04:51 |
ranvijaidba
Messages: 71 Registered: May 2008 Location: Bangalore
|
Member |
|
|
Hi Team,
I have one requirement as part automation. i have declared some variable at unix level in shell script. i want to use variable values in SQL command and PL/SQL blocks. for eg
code:
export owner=`echo $line|cut -d':' -f1`
export tname=`echo $line|cut -d':' -f2`
echo $owner
echo $tname
sqlplus -s '/as sysdba' $owner $tname<<EOF >abc.log
DECLARE
v_owner varchar2(15) := '$1';
v_tname varchar2(25) := '$2';
BEGIN
dbms_output.put_line('Value of Table Name:'||v_tname);
dbms_output.put_line('Value of Table Owner:'||v_owner);
end;
EOF
Please help me on this. how we can use variable inside pl/sql block.
thanks
|
|
|