Binds a PL/SQL cursor variable to a BDL cursor.
A cursor can be defined in a PL/SQL block and as a stored procedure parameter. Within a BDL script, it is possible to reference to a PL/SQL cursor by binding it to a BDL cursor.
Ora.bdh
OraBindCursor( in cCursor : cursor, in sName : string, out cPLCursor : cursor): boolean;
true if successful
false otherwise. In this case, you can use the OraOciError function to retrieve the Oracle OCI error code
Parameter | Description |
---|---|
cCursor | Cursor associated with a database connection |
sName | Name of the cursor defined in the PL/SQL block. This parameter must include the preceding colon identifying it as a cursor |
cPLCursor | Variable receiving the cursor defined in the PL/SQL block |
var hConnection : number; cCursor, cSelect : cursor; dcltrans transaction TMain var nAge : number; sName : string; begin OraLogon(hConnection, "user", "password", "orclnet2"); OraOpen(cCursor, hConnection); OraParse(cCursor, sqlSelect); OraBindCursor(cCursor, ":cursor", cSelect); OraExec(cCursor); OraDefine(cSelect, 1, SQLT_CHR, 32); OraDefine(cSelect, 2, SQLT_INT); while OraFetch(cSelect) do sName := OraGetString(cSelect, "1"); nAge := OraGetInt(cSelect, "2"); write(sName, 32); write(nAge, 5); writeln; end; OraClose(cCursor); OraClose(cSelect); OraLogoff(hConnection); end TMain; dclsql sqlSelect: [BEGIN OPEN :cursor FOR SELECT * FROM persons; END;]
Howard 33Mark 12Michael 44Bobby 61Sara 38
Oracle: Programmer's Guide to the Oracle Call Interface: Using PL/SQL in an OCI Program