Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Passing UNIX shell variables to a stored procedure

Re: Passing UNIX shell variables to a stored procedure

From: Hans Forbrich <forbrich_at_yahoo.net>
Date: Tue, 04 Nov 2003 22:40:14 GMT
Message-ID: <3FA82AFF.AF5269E3@yahoo.net>


Assumption: you want to comunicate between Unix Shell and SQL*Plus:

If you are trying to pass stuff from shell to sqlplus, have the shell create .sql file filled with DEFINEs that you will execute in SQLPlus.

eg: use

echo "DEFINE abc = $1 " >> pass_to_sql.sql
echo "VARIABLE acd number" >> pass_to_sql.sql
echo "EXECUTE :acd := $2" >> pass_to_sql.sql

sqlplus scott/tiger_at_ora1
> @pass_to_shell
> prompt &abc
> print :acd

If you are trying to pass stuff from sqlplus to shell, redirect SQLPlus output to a .sh file that you can 'read'

eg: something like
sqlplus scott/tiger_at_ora1
> rem turn off all unnecessary settngs such as verify
> spool "pass_to_shell.sh"
>
> select "export ABC=" || sysdate from dual;
> select "echo Hi " from dual;
> spool off
>
> host pass_to_shell.sh
>

And so on.
'Hans Received on Tue Nov 04 2003 - 16:40:14 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US