outRefCursor method
Create a REF CURSOR OUT parameter (user-friendly helper)
REF CURSOR allows stored procedures to return result sets. The cursor is returned as an OracleStatement that can be used to fetch rows.
Example:
final cursorOut = await conn.outRefCursor();
await conn.callproc(
'get_employees',
keywordParameters: {'emp_cursor': cursorOut},
);
// Get the cursor as an OracleStatement
final cursor = await cursorOut.getValue() as OracleStatement;
// Fetch rows from the cursor
await for (final row in cursor.rows()) {
print('Employee: ${row['NAME']} - Salary: ${row['SALARY']}');
}
await cursor.close();
cursorOut.dispose();
See also:
- outString for string OUT parameters
- outInteger for integer OUT parameters
- callproc for calling stored procedures
Implementation
Future<OracleVariable> outRefCursor() async {
return createVar(
oracleType: DPI_ORACLE_TYPE_STMT,
nativeType: DPI_NATIVE_TYPE_STMT,
direction: BindDirection.output,
);
}