Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) B14308-01 |
|
Applies To
Description
This method returns the Oracle error number for the last database-related error in the session.
Usage
long ServerErrorNumber(void) const;
Remarks
This method returns the Oracle error number for the most recent database-related error, if there has been an error since the session was created or the server error was reset with ServerErrorReset. Errors that occur while opening a database or in a transactional method will be reported on the session. Other errors are reported on the database.
A value of 0 means no error.
Return Value
Returns the Oracle error number.
Example
An example of a server error:
// open an ODatabase object
ODatabase odb("ExampleDB", "scott", "tiger");
// try to open a dynaset with a bad column name
ODynaset dyn(odb, "select xx from emp");
// if that didn't work, get the error number
if (!dyn.IsOpen())
{
long errno = odb.ServerErrorNumber();
}