Path: news.easynews.com!easynews!crtntx1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed1.cidera.com!Cidera!cyclone.tampabay.rr.com!news-post.tampabay.rr.com!typhoon.tampabay.rr.com.POSTED!not-for-mail
From: "Ranga Chakravarthi" <ranga@cfl.rr.com>
Newsgroups: comp.databases.oracle.misc
References: <3b58c6c3.0112110940.3f5e71f2@posting.google.com>
Subject: Re: calling pl/sql function from unix shell script
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Message-ID: <U7OR7.79289$Ga5.12311943@typhoon.tampabay.rr.com>
Date: Wed, 12 Dec 2001 19:22:28 GMT
NNTP-Posting-Host: 24.95.245.47
X-Complaints-To: abuse@rr.com
X-Trace: typhoon.tampabay.rr.com 1008184948 24.95.245.47 (Wed, 12 Dec 2001 14:22:28 EST)
NNTP-Posting-Date: Wed, 12 Dec 2001 14:22:28 EST
Organization: RoadRunner - Central Florida
Xref: easynews comp.databases.oracle.misc:73689
X-Received-Date: Wed, 12 Dec 2001 12:22:29 MST (news.easynews.com)

set m_var `sqlplus -s uid/pw @script.sql`
(be careful to use the 'evaluation' back-quotes: `...`) where script.sql
looks something like:
set feedback off
set pagesize 0
set linesize xxx
set trimspool on
ttitle off
btitle off
set verify off
select sysdate
from dual
/
exit
echo ${m_var}

please check syntax before you run.

HTH,
Ranga Chakravarthi

"Patrick" <P_swiggers@yahoo.com> wrote in message
news:3b58c6c3.0112110940.3f5e71f2@posting.google.com...
> I want to call a pl/sql function from a unix shell script and get the
> return value. This is how I use sql from within a script:
>    SQL_STR="select sysdate from dual;"
>    echo ${SQL_STR} | sql
>    echo $?
> How can I do the same thing but calling a pl/sql function and getting
> the returned value?
>


