Re: Calling PLSQL function in a shell script

From: Jeremy <jeremy0505_at_gmail.com>
Date: Thu, 9 Nov 2006 18:16:03 -0000
Message-ID: <MPG.1fbd80c3d470c76398a34b_at_news.individual.net>


In article <1163090848.201913.252660_at_h54g2000cwb.googlegroups.com>, says...
> Have been trying this for an entire day now with no luck:
>
> Have a PLSQL function func(var1, var2);
> I have called this in the shell script as:
>
> sqlplus -S << EOF > sqlerrlog
> $connection_strring
> set serveroutput on;
> declare
> d varchar2(1);
> BEGIN
> dbms_output.put_line('IN PL/SQL block');
> d:=func(var1, var2);
> END;
> exit;
> EOF
>
> However, this is not only 'NOT WORKING', but does not even enter the
> PLSQL block.
> If i tried just an SQL statement in place of the PLSQL block, it just
> works fine. Also, the PLSQL block works fine when called from the SQL
> prompt.
> Even a simple dbms_output statement does not work in the PLSQL block
> here.
>
> Please let me know if I am getting anything wrong here or let me know
> how to call the function in the script.
>
>

First: make it work in a sqlplus environment interactively.

Then try and wrap it up in the shell script.

But I can tell you that what you have doesn't execute because you have no /

So try:

BEGIN
dbms_output.put_line('IN PL/SQL block'); d:=func(var1, var2);
END;
/

-- 
jeremy
Received on Thu Nov 09 2006 - 19:16:03 CET

Original text of this message