Re: Sql*Plus in Shell Script Question

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 7 Aug 2001 20:46:00 +0200
Message-ID: <997209963.18592.0.pluto.d4ee154e_at_news.demon.nl>


"Venki Ramachandran" <venkir_at_pacbell.net> wrote in message news:3B703079.B4E6646E_at_pacbell.net...
> Hi,
>
> I have a shell script as follows:
>
> #!/bin/sh
>
> MYNAME='Joe'; export MYNAME
>
> sqlplus user/password -S <<File
> Define v_name=$MYNAME
>
> execute some_proc('&v_name', v_totalrecords);
>
> File
>
> The problem is that the variable MYNAME gets passed successfully, but
> the procedure does not execute because of the second variable
> 'v_totalrecords. It is an 'IN/OUT' variable and it needs to be DECLARED.
> It works in sqlplus prompt as in:
>
> sqlplus>declare
> > v_totalrecords number
> >BEGIN
> > v_total_records := null;
> >execute some_proc('Joe', v_totalrecords);
> > END;
> >/
> Procedure completed successfully.
>
> The problem is how do you declare an 'IN/OUT' variable in sqlplus inside
> a shell script. I have tried different variations, but have been
> unsuccessful. The moment I put the above declare, begin and end
> statements around the exeute statement, it does not run or the messages
> do not show up. Any help will be appreciated. Thanks.
>
>
>

Execute is a sql*plus command.
You can leave it out in pl/sql blocks.
Other than that I can't see on earth why the code above doesn't work.

Hth,

Sybrand Bakker, Senior Oracle DBA Received on Tue Aug 07 2001 - 20:46:00 CEST

Original text of this message