Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Dynamic SQL and REF CURSORS ?

Dynamic SQL and REF CURSORS ?

From: Nicholas Tombs <nictombs_at_bigfoot.com>
Date: Thu, 18 Feb 1999 20:06:54 -0000
Message-ID: <7ahrdm$m4u$1@newnews.global.net.uk>


Hi,

I am trying to return a ref cursor from a stored procedure by defining a dynamic SQL statement, the problem is that I cannot quite figure out how to get the data into the ref cursor. Below is a very simplistic example, please excuse any typo's. The documentation on this topic only shows how to execute the query and put the variables into local PLSQL variables, not ref cursors.

Does anyone have any ideas ?
Regards
Nicholas Tombs

Example (simplistic case) :-

type MyReturnRecordType is

        TableDefinition%RowType;

procedure GetSelectedRecords(SearchValue INTEGER, zCursor IN OUT MyReturnRecordType) is
  queryString VARCHAR2(1024);
  nRows NUMBER;
  iCursor NUMBER;
begin

   iCursor := dbms_sql.open_cursor;
  nRows := dbms_sql.parse(iCursor,queryString,DBMS_SQL.V7);   nRows := dbms_sql.execute(icursor);

  dbms_sql.close_cursor(iCursor);

end; Received on Thu Feb 18 1999 - 14:06:54 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US