Home > Archive > Other Oracle database topics > June 2005 > Calling Oracle Stored Procedure from Shell Script









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Calling Oracle Stored Procedure from Shell Script
beenamore@gmail.com

2005-06-24, 3:23 am

Hi,

I have a stored procedure proc1(param1 in varchar2, param2 in
varchar2). I have tested this one and it works fine.

I need to call this procedure from a shell script. I am using

sqlplus -S ${ORACLE_USER}/$& #123;ORACLE_PASSWORD
}@${ORACLE_CONN}
@$& #123;INSTALL_ROOT}pr
oc.sql

and proc.sql is
begin
exceute proc1('param1','para
m2');
end;

When I execute the above, the shell script just hangs. Can anyone tell
me the correct way of calling a stored procedure from sh program?

Thanks for your help,
Beena

Dmitry E. Loginov

2005-06-24, 3:23 am


<beenamore@gmail.com> wrote in message
news:1119595116.117457.322180@g14g2000cwa.googlegroups.com...
> Hi,
>
> I have a stored procedure proc1(param1 in varchar2, param2 in
> varchar2). I have tested this one and it works fine.
>
> I need to call this procedure from a shell script. I am using
>
> sqlplus -S ${ORACLE_USER}/$& #123;ORACLE_PASSWORD
}@${ORACLE_CONN}
> @$& #123;INSTALL_ROOT}pr
oc.sql
>
> and proc.sql is
> begin
> exceute proc1('param1','para
m2');
> end;
>


Just add EXIT command to end of the proc.sql file.

> When I execute the above, the shell script just hangs. Can anyone tell
> me the correct way of calling a stored procedure from sh program?
>
> Thanks for your help,
> Beena
>



Rauf Sarwar

2005-06-24, 7:23 am



beenamore@gmail.com wrote:
> Hi,
>
> I have a stored procedure proc1(param1 in varchar2, param2 in
> varchar2). I have tested this one and it works fine.
>
> I need to call this procedure from a shell script. I am using
>
> sqlplus -S ${ORACLE_USER}/$& #123;ORACLE_PASSWORD
}@${ORACLE_CONN}
> @$& #123;INSTALL_ROOT}pr
oc.sql
>
> and proc.sql is
> begin
> exceute proc1('param1','para
m2');
> end;
>
> When I execute the above, the shell script just hangs. Can anyone tell
> me the correct way of calling a stored procedure from sh program?
>
> Thanks for your help,
> Beena


begin
proc1('param1','para
m2');
end;
/
exit

In the above, removed execute... execute means begin end; and is a
SQL*Plus command which has no meaning inside PLSQL block thus resulting
in error. There is an "execute immediate" inside PLSQL but I don't
think that is what you mean here.
Also added / to terminate PLSQL block (Most likely the cause of hang)
and exit as suggested by other poster.

Regards
/Rauf

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com