Updating from sys_refcursor

Stephen

Member²
Hi Marco!

I have an Oracle package with a function that returns a sys_refcursor of type tbl$customer.

I retrieve the refcursor and process it within C++ Builder without issues. At no point do I close the cursor / TOracleDataSet.

What I would like to do is then pass the cursor BACK to Oracle and have some updates be performed. To get the sys_refcursor reference, I'm passing back my TOracleDataSet's ExternalCursor (i.e. tbl->ExternalCursor).

My function in the package looks like:
some_update(pCustCursor in sys_refcursor) return integer is
rec rec$customer;
begin
loop
fetch pCustCursor into rec;
exit when pCustCursor%notfound;

-- do what I need to do based upon record information here

end loop;
return 1;
end;

My function fails at the fetch. The rec$customer and tbl$customer types are correct and match the structure of the cursor.

Is what I'm trying to do even possible?

Thank you so much,
Stephen

 
Last edited:
If the cursor was already opened and fecthed by the TOracleDataSet, I don't think you can pass it back to the server and access it again.
 
Back
Top