Cancels a query after a number of rows have been fetched. This function releases any resources associated with the cursor except the internal representation of the parsed SQL statement.
Ora.bdh
OraCancel(in cCursor: 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. |
var hConnection : number; cCursor : cursor; dcltrans transaction TMain var sName : string; nAge : number; begin OraLogon(hConnection, "user", "password", "orclnet2"); OraOpen(cCursor, hConnection); OraParse(cCursor, sqlSelect); OraExec(cCursor); OraDefine(cCursor, 1, SQLT_CHR, 32); OraDefine(cCursor, 2, SQLT_INT); // fetch first row OraFetch(cCursor); sName := OraGetString(cCursor, "1"); nAge := OraGetInt(cCursor, "2"); write(sName, 32); write(nAge, 3); writeln; OraCancel(cCursor); // Ignore Oracle error 1002: fetch out of sequence OraIgnoreError(cCursor, 1002); // try to fetch second row OraFetch(cCursor); OraClose(cCursor); OraLogoff(hConnection); end TMain; dclsql sqlSelect: SELECT * FROM persons;
Howard 33 OCI-API Class 0 Error (Warning) 1002 in OraFetch(OFETCH, OFEN): ORA-01002: fetch out of sequence
Oracle's Programmer's Guide to Oracle Call Interface for the Wrapped Oracle function: ocan