refCursor static method

Future<OracleVariable> refCursor({
  1. required Pointer<dpiConn> connection,
  2. required Pointer<dpiContext> context,
  3. required DpiOracle dpiOracle,
  4. BindDirection direction = BindDirection.output,
})

Create a REF CURSOR OUT parameter

REF CURSOR allows stored procedures to return result sets.

Example:

final cursorOut = OutParam.refCursor();
await conn.callproc('get_employees', outParams: {'emp_cursor': cursorOut});

// Get the cursor as an OracleStatement
final cursor = cursorOut.getValue() as OracleStatement;

// Fetch rows from the cursor
await for (final row in cursor.rows()) {
  print('Employee: ${row['NAME']}');
}

await cursor.close();
cursorOut.dispose();

Implementation

static Future<OracleVariable> refCursor({
  required Pointer<dpiConn> connection,
  required Pointer<dpiContext> context,
  required DpiOracle dpiOracle,
  BindDirection direction = BindDirection.output,
}) {
  return OracleVariable.create(
    dpiOracle: dpiOracle,
    connection: connection,
    context: context,
    oracleType: DPI_ORACLE_TYPE_STMT,
    nativeType: DPI_NATIVE_TYPE_STMT,
    direction: direction,
  );
}