Oracle Objects for OLE C++ Class Library
Release 9.0.1

Part Number A90172-01

Home

Book List

Contents

Master Index

Feedback

Error Handling

The simplest kind of error handling is to know whether a method succeeded in its operation or not. This level of error handling is accomplished by looking at the return value of the method. Most methods in the library return a result of type oresult. An oresult will either have the value OSUCCESS, which indicates that the method worked, or OFAILURE, which indicates that some error occurred during the method's execution.

Note: Beginning with this release, newly introduced methods may throw an
OException object in the case of an error.

After an error has occurred, you will often want more information about exactly what went wrong. There are two broad categories of problems:

Errors that occur in the server. These are things like invalid SQL statements, attempting to access records that are locked, etc.

Errors occurring in the class library. These are things like improperly initialized objects, invalid arguments, out of memory conditions and so on.

The two categories of problems are reported in different ways.

The Oracle errors are reported via the ServerErrorNumber and GetServerErrorText methods of OSession and ODatabase. Errors that occur when connecting to the database, or in the execution of transaction operations, will be reported via OSession. Errors that occur while processing an SQL statement, for instance when opening a dynaset or using ExecuteSQL, will be reported via ODatabase. The number returned by ServerErrorNumber is a standard Oracle error number. An error number of 0 indicates no error. The text returned by GetServerErrorText is the standard Oracle error message. For more information about Oracle errors consult your Oracle documentation.

The class library errors are reported via the ErrorNumber and GetErrorText methods that are supported by most of the objects (all those that inherit these methods from OOracleObject). Each object will have available the most recent state of that object. The object's error state is cleared at the beginning of executing each method. GetErrorText will not have explanatory text available for all errors.

Because error reporting is done via additional calls rather than through returns of error codes it is possible to obtain error information about the execution of methods that cannot have error return values such as constructors and overloaded assignment operators. After using a constructor, especially a "construct and open" constructor or an assignment operator you should check an object's error state by calling ErrorNumber.

The following table lists all possible error codes returned by ErrorNumber and a brief explanation of each:

Constant
Value
Description
OERROR_NONE
0
No error
OERROR_NOINTER
11
Internal Error
OERROR_MEMORY
12
Couldn't allocate necessary memory.
OERROR_BADERR
13
Internal Error
OERROR_INVPARENT
14
An attempt was made to get an object from an unopened object.
OERROR_SYSTEM
15
Internal Error
OERROR_NOTOPEN
16
An attempt was made to use an unopened object
OERROR_BADARG
17
One of the arguments to the method is invalid.
OERROR_INVRECORD
18
The current record is not valid.
OERROR_ADVISEULINK
4096
Internal error: Invalid advisory connection.
OERROR_POSITION
4098
An attempt was made to retrieve a field value from an empty dynaset.
OERROR_NOFIELDNAME
4099
An invalid field name was specified.
OERROR_TRANSIP
4101
A BeginTransaction was specified while a transaction is already in progress
OERROR_TRANSNIPC
4104
A CommitTransaction was specified without first executing BeginTrans.
OERROR_TRANSNIPR
4105
A Rollback was specified without first executing BeginTrans.
OERROR_NODSET
4106
Internal error: System attempted to destroy non-existent dynaset.
OERROR_INVROWNUM
4108
An attempt was made to reference an invalid row. This will happen when IsEOF or IsBOF is True or when the current row has been deleted and no record movement has occurred.
OERROR_TEMPFILE
4109
An error occurred while trying to create a temporary file for data caching.
OERROR_DUPSESSION
4110
An attempt was made to create a named session that already exists.
OERROR_NOSESSION
4111
Internal error: System attempted to destroy non-existent session.
OERROR_NOOBJECTN
4112
An attempt was made to reference a named object of a collection (other than the fields collection) that does not exist.
OERROR_DUPCONN
4113
Internal error: Duplicate connection name.
OERROR_NOCONN
4114
Internal error: System attempted to destroy non-existent connection.
OERROR_BFINDEX
4115
An invalid field index was specified. The range of indices is 0 to Count -1.
OERROR_CURNREADY
4116
Internal error: System attempted to move to row in invalid dynaset.
OERROR_NOUPDATES
4117
An attempt was made to change the data of a non-updatable dynaset.
OERROR_NOTEDITING
4118
An attempt was made to change a fields value without first executing StartEdit.
OERROR_DATACHANGE
4119
An attempt was made to Edit data in the local cache, but the data on the Oracle server has been changed.
OERROR_NOBUFMEM
4120
Out of memory for data binding buffers.
OERROR_INVBKMRK
4121
An invalid bookmark was specified.
OERROR_BNDVNOEN
4122
Internal error: Bind variable not enabled.
OERROR_DUPPARAM
4123
An attempt was made to create a named parameter using Add, but that name already exists.
OERROR_INVARGVAL
4124
An invalid offset or length parameters was passed to GetChunk or an internal error has occurred using AppendChunk.
OERROR_INVFLDTYPE
4125
An attempt was made to use GetChunk or Append Chunk on a field that was not of the type Long or Long Raw.
OERROR_TRANSFORUP
4127
A SELECT ... FOR UPDATE was specified without first executing BeginTransaction
OERROR_NOTUPFORUP
4128
A SELECT ... FOR UPDATE was specified but the query is non-updatable.
OERROR_TRANSLOCK
4129
A Commit or Rollback was executed while a SELECT ... FOR UPDATE is in progress.
OERROR_CACHEPARM
4130
An invalid cache parameter was specified.
OERROR_FLDRQROWID
4131
An attempt was made to reference a field that requires a ROWID (Long or Long Raw), but the ROWID was not available.
OERROR_OUTOFMEMORY
4132
Internal Error
OERROR_MAXSIZE
4135
Element size specified in AddTable exceeds the maximum allowed size for that variable type. See AddTable Method for more details.
OERROR_INVDIMENSION
4136
Dimension specified in AddTable is invalid (negative). See AddTable Method for more details.
OERROR_MAXBUFFER
4137
Buffer size for parameter array variable exceeds 32512 bytes (OCI limit).
OERROR_ARRAYSIZ
4138
Dimensions of array parameters used in insert/update/delete statements are not equal.
OERROR_ARRAYFAILP
4139
Error processing arrays. For details refer to OO4OERR.LOG in the windows directory.
OERROR_NONBLKINPROGRESS
4153
Non-blocking operation in progress
OERROR_NONONBLKINPROGRESS
4154
Operation is valid only when non-block is in progress

These values can be found in the oraconst.txt file.

Find Method Parser Errors

Find method parser errors occur when the parser cannot parse the expression (find clause) in a Find method. These errors specify what part of the expression caused the error.

Constant
Value
Description
OERROR_STOVER
4496
Stack overflow.
OERROR_SYNTAX
4497
Syntax error
OERROR_MISPLC
4498
Misplaced parenthesis
OERROR_MISQTE
4499
Misplaced quotation marks
OERROR_MISPAR
4500
WARNING: Missing closing parenthesis
OERROR_EXPCTD
4501
Usually open parentheses expected
OERROR_PRSERR
4502
Unknown parser error condition
OERROR_DUMMY
4503
Syntax not supported
OERROR_INVCOL
4504
Invalid column name
OERROR_TOKEN
4505
Maximum token size exceed in token.
OERROR_COLTYPE
4506
Unsupported data type
OERROR_UNXPTD
4507
Unexpected token found.

Find Method Runtime Errors

Find method runtime errors occur when the system cannot evaluate a find expression. Such errors are rare. When one occurs, the parser might have generated incorrect code.

Constant
Value
Description
OERROR_INSTR
4516
Internal error: Invalid instruction
OERROR_STACK
4517
Internal error: Stack over/under-flow
OERROR_CONVERT
4518
Invalid type conversion
OERROR_DATA
4519
Invalid datatype
OERROR_SQLFUNC
4520
SQL function missing argument
OERROR_COMP
4521
Invalid comparison
OERROR_SQLEXEC
4522
Select from dual failed
OERROR_SQLTYPE
4523
Invalid datatype in Select from dual


 
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.

Home

Book List

Contents