Home » SQL & PL/SQL » SQL & PL/SQL » Calling packaged procedure with Refcursor as out parameter over DBlink
Calling packaged procedure with Refcursor as out parameter over DBlink [message #525956] Fri, 07 October 2011 02:09 Go to next message
himanshu2704
Messages: 1
Registered: October 2011
Location: Chandigarh
Junior Member
Hi!

I have a requirement in which I have to call a packaged procedure created in one database DB1 to other database DB2 through a DBLink. The packaged procedure to be called has refcursor as OUT parameter.

When I run the procedure in DB1 , it works fine:
Declare
v_ref_data SYS_REFCURSOR;
a1 Number;
b1 varchar2(100);
c1 varchar2(100);

Begin
apps.XXCU_DB1_PKG.get_DB1('101062','9138', v_ref_data);

FETCH v_ref_data into a1,b1,c1;
dbms_output.put_line(a1|| ' '|| b1|| ' '|| c1);

End;

When I run the packaged procedure from DB2 using DBlink, it gives error:

Declare
v_ref_data SYS_REFCURSOR;
a1 Number;
b1 varchar2(100);
c1 varchar2(100);

Begin
apps.XXCU_DB1_PKG.get_DB1@dblink('101062','9138', v_ref_data);

FETCH v_ref_data into a1,b1,c1;
dbms_output.put_line(a1|| ' '|| b1|| ' '|| c1);

End;

Error report:
ORA-24338: statement handle not executed
ORA-06512: at line 14
24338. 00000 - "statement handle not executed"
*Cause: A fetch or describe was attempted before executing a
statement handle.
*Action: Execute a statement and then fetch or describe the data.
anonymous block completed

Kindly help me in this. I read somewhere on other forums that refcursors can not be passed through the DB links, is it true??

Thanks in Advance

Regards
Himanshu Mittal
Re: Calling packaged procedure with Refcursor as out parameter over DBlink [message #525959 is a reply to message #525956] Fri, 07 October 2011 02:20 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You cannot transport a ref cursor across a db link.

Before your next questions, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Regards
Michel
Previous Topic: Select Query - Using IN
Next Topic: min_date set flag 1 and max dates set flag as 2
Goto Forum:
  


Current Time: Thu Apr 25 16:43:23 CDT 2024