ODAC

TOraDataSet.OpenNext Method

Opens next cursor or rowset in the statement.

Class

TOraDataSet

Syntax

function OpenNext: boolean;

Return Value
True, if DataSet opens.

Remarks

Call the OpenNext method to get the second and other Cursors or ResultSets while executing a query. If DataSet opens, it returns True. If there are no cursors or record sets to be represented, it will return False, and the current record set will be closed.

Example for working with cursors:

 OraQuery1.SQL.Text := 'BEGIN ' +
                        '  OPEN :Cur1 FOR SELECT * FROM Dept; ' +
                        '  OPEN :Cur2 FOR SELECT * FROM Emp; ' +
                        'END;';

  OraQuery1.Params[0].DataType := ftCursor;
  OraQuery1.Params[0].ParamType := ptOutput;
  OraQuery1.Params[1].DataType := ftCursor;
  OraQuery1.Params[1].ParamType := ptOutput;

  OraQuery1.Open;     // open first cursor
  OraQuery1.OpenNext; // open next cursor


Example for working with Implicit Result Sets in Oracle 12c and higher:

  OraQuery1.SQL.Text := 'DECLARE ' +
                        '  dept_cur SYS_REFCURSOR; ' +
                        '  emp_cur SYS_REFCURSOR; ' +
                        'BEGIN ' +
                        '  OPEN dept_cur FOR SELECT * FROM Dept; ' +
                        '  DBMS_SQL.RETURN_RESULT(dept_cur); ' +
                        '  OPEN emp_cur FOR SELECT * FROM Emp; ' +
                        '  DBMS_SQL.RETURN_RESULT(emp_cur); ' +
                        'END;';

  OraQuery1.Open;     // open first result set
  OraQuery1.OpenNext; // open next result set
© 1997-2022 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback