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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to start a Stored Procedure directly from Unix shell skript ?

Re: How to start a Stored Procedure directly from Unix shell skript ?

From: Joel Garry <joel-garry_at_home.com>
Date: 11 Mar 2003 13:32:23 -0800
Message-ID: <91884734.0303111332.1f74bf14@posting.google.com>


"Jan Gelbrich" <j_gelbrich_at_westfalen-blatt.de> wrote in message news:<b4l0d4$1ujt4h$1_at_ID-152732.news.dfncis.de>...
> Hello,
>
> is there a way to start a *stored procedure* (not a SQL script)
> from a Unix *shell script* using SQL+.
>
> I know the way how to start a SQL-Script from the shell,
> as documentation says:
> ...
> sqlplus user/pass @myscript [arg1 ...]
> ...
> And inside this SQL-script you may say
> EXEC myPU ...
>
> We tried it the same way with a PU, with no success ...
> ...
> sqlplus user/pass myPU
> no way ...
> sqlplus user/pass exec myPU
> no way ...
>
> Is it possible at all ? I can hardly imagine that it is not ...
> I did RTFMing but did not find useful tips ...
>
> (Oracle EE 8.1.7, AIX 4.3.3)
>
> TIA
>
> Jan

Try:

sqlplus user/pass << EOF
[your commands]
EOF This is called a here (or hereis) script, see any unix text or man ksh. Some additional notes:

You probably don't want to have a habit or script of using the password on the command line, as many unix let you see it with ps or other utilities. So you can pass it into shell variables, and put those at the beginning of your command. You can put shell variables into any part of the command, with care.

Protect the script so that only people that are authorized can read it. (I saw one place that put all their scripts, including Oracle admin scripts, in root crontab, and left the thing world readable!)

Oracle's idea of standard and error output may, uh, conflict with shell programmers ideas. Play with redirecting output and spooling until you understand what is going on.

orafaq.com has some other syntax, like echoing the commands into a pipe to sqlplus.

jg

--
@home.com is bogus.
Any personal care product may clog pipes.
Received on Tue Mar 11 2003 - 15:32:23 CST

Original text of this message

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