• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1896
  • Last Modified:

ORA-03113 error while executing an Oracle function from PowerBuilder


My Stored Procedure is
create or replace procedure concatname(a varchar2,
                              b varchar2,
                              c out varchar2)
    c := a || b;

My Function is
create or replace function ex(sp varchar2)
  return varchar2 as
   v varchar2(100);
    execute immediate 'begin '||sp||'(''test'','' procedure'',:o); end;'
    using out v;
    return v;

Iam using PowerBuilder 8 as a FRONTEND Tool( connecting to ORACLE db through ODBC driver) for executing the above function where i will pass the stored procedure name ( CONCATNAME ) as an argument.

While executing this function from the frontend tool iam getting the following error.

SQLCA.SqlErrText = ''SQLSTATE - 08S01||[ORACLE][ODBC][ORA]ORA-03113: end-of-file on communication channel.

I dont know, why this error is coming ?  As the function is executing fine through ISQL ?

Can anybody help me ? How to avoid this error ( ORA-03113 ) ?
  • 2
2 Solutions
Execute immediate won't work with stored procedures where you are expecting results back.  It shouldn't have disconnected you from the database, but it still wouldn't have worked.

Check out Remote Procedure Calls,declaring in the help.  Basically, create a custom transaction object and in the local external functions, declare your procedure as:
SUBROUTINE concatname(string a, string b, ref string c) RPCFUNC;

Then simply call as SQLCA.concatename(a,b,c).

If you want dynamic invocation as indicated by your function, you really need to check out Dynamic SQL Syntax 4 in the help, which is not trivial.
I agree with Michael as I find this to be a better practice.  My only comment is since you want a return you declare it as a function.  Use Subroutine when you don't want a return.
I agree, the current Oracle procedure should be a function returning a VARCHAR2 instead of an OUT parameter and then change the corresponding PowerBuilder declaration to match.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now