Home » Infrastructure » Unix » How to pass unix declared variable into SQL and PL SQL block (Oracle Database 11.2.0.4,Operating System: AIX 7)
How to pass unix declared variable into SQL and PL SQL block [message #644711] Sun, 15 November 2015 04:51 Go to previous message
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Solaris version that uses libm.so.2
Next Topic: oracle function invoked using shell script
Goto Forum:
  


Current Time: Thu Apr 18 23:24:57 CDT 2024