Question

I have to write a stored procedure which invokes a remote procedure via db link. This procedure returns a cursor. When I try to iterate over this cursor I get ORA-01001: invalid cursor Error. I read on some forums that simply it's not allowed to access cursors over db links, but I'm not convinced about that. Anyone know how to solve it? What is important here I can't modify existing remote method.

below is a code of my procedure:

declare
  TYPE generic_cursor IS REF CURSOR;
  refCursorValue generic_cursor;  
 field1 table1.column1@my_db_link%type;
begin

  rempote_package.remote_method@my_db_link('33337136','','',refCursorValue);

 loop
      fetch refCursorValue into  field1;      -- here exception is thrown               
      exit when refCursorValue%NOTFOUND;
  end loop;
  close refCursorValue;
end;

interface of remote method is as below:

PROCEDURE remoteMethod (p1 IN VARCHAR2,
 p2 IN VARCHAR2,
 p3 IN VARCHAR2,
 rst_data OUT pkg_resultset.generic_cursor)

and pkg_resultset.generic_cursor has got following definition:

 TYPE generic_cursor IS REF CURSOR;
Was it helpful?

Solution

as best as i can tell, you cannot pass a ref cursor over a database link. but you can pass a table. see this example from Ask Tom: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4254116170549

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top