Oracle7 Server Application Developer's Guide

Contents Index Home Previous Next

Locating Errors

There are additional functions in the DBMS_SQL package for obtaining information about the last referenced cursor in the session. The values returned by these functions are only meaningful immediately after a SQL statement is executed. In addition, some error-locating functions are only meaningful after certain DBMS_SQL calls. For example, you call LAST_ERROR_POSITION immediately after a PARSE.

LAST_ERROR_POSITION Function

Returns the byte offset in the SQL statement text where the error occurred. The first character in the SQL statement is at position 0.

DBMS_SQL.LAST_ERROR_POSITION RETURN INTEGER;

Call this function after a PARSE call, before any other DBMS_SQL procedures or functions are called.

LAST_ROW_COUNT Function

Returns the cumulative count of the number of rows fetched.

DBMS_SQL.LAST_ROW_COUNT RETURN INTEGER;

Call this function after a FETCH_ROWS or an EXECUTE_AND_FETCH call. If called after an EXECUTE call, the value returned will be zero.

LAST_ROW_ID Function

Returns the ROWID of the last row processed.

DBMS_SQL.LAST_ROW_ID RETURN ROWID;

Call this function after a FETCH_ROWS or an EXECUTE_AND_FETCH call.

LAST_SQL_FUNCTION_CODE Function

Returns the SQL function code for the statement. These codes are listed in the Programmer's Guide to the Oracle Call Interface.

DBMS_SQL.LAST_SQL_FUNCTION_CODE RETURN INTEGER;

You should call this function immediately after the SQL statement is executed; otherwise, the return value is undefined.


Contents Index Home Previous Next