executing procedure thru unix shell script
407048Jun 7 2007 — edited Jun 7 2007I am on sun solaris and accessing an Oracle 10g database. I write shell scripts to log into sql plus, do stuff and also to run exports/imports all the time. But this is the first time I am gonna execute a stored procedure using shell script.
I have a procedure called DISROLBAC that is compiled, ran and tested successfully in oracle sql plus
SQL> EXECUTE CLIENT_54_IT.DISROLBAC('06/04/2007');
PL/SQL procedure successfully completed.
Now, I want to write a unix shell script and execute this procedure via the shell script. And obviously I want to pass that input variable(seen above as '06/04/2007') at run time while executing the script.
If someone has done this before, can I get some tips ?
I was thinking something like writing the shell script as follows :
#test.ksh :
##########
sqlplus /NOLOG <<EOF
CONNECT username/password@database
EXECUTE CLIENT_54_IT.DISROLBAC('{1}');
exit
EOF
##########
And then run,
test.ksh 06/04/2007
Will this work ? I am really wanting to know that it works before I execute one. !! Also, I have a bunch of statements like
dbms_output.put_line(SQLERRM);
dbms_output.put_line('Process Id is '||v_seqprocessid ||'Date entered is '||date_in);
How do I get these dbms output line results into a OS spool file when the shell script executes ?