Ref cursor support v15
The EDB Postgres Advanced Server Open Client Library supports the use of REF CURSOR
as OUT
parameters in PL/SQL procedures that are compatible with Oracle. Support is provided through the following APIs:
OCIBindByName
OCIBindByPos
OCIBindDynamic
OCIStmtPrepare
OCIStmtExecute
OCIStmtFetch
OCIAttrGet
The EDB OCL Connector also supports the SQLT_RSET
data type.
This example invokes a stored procedure that opens a cursor and returns a REF CURSOR
as an output parameter. The code sample assumes that a PL/SQL procedure named openCursor
, with an OUT
parameter of type REF CURSOR
, was created on the database server and that the required handles were allocated:
Allocate handles for executing a stored procedure to open and use the REF CURSOR
:
Then, prepare the PL/SQL block that's used to open the REF CURSOR
:
Bind the PL/SQL openCursor OUT
parameter:
Use the stmtOpenRefCursor
statement handle to call the openCursor
procedure:
At this point, the stmtUseRefCursor
statement handle contains the reference to the cursor. To obtain the information, define output variables for the ref cursor:
Then, fetch the first row of the result set into the target variables: