Start of change

-802   EXCEPTION ERROR exception-type HAS OCCURRED DURING operation-type OPERATION ON data-type DATA, POSITION position-number

Explanation

An exception error has occurred in the processing of an SQL arithmetic function or arithmetic expression. The exception error occurred in one of the following areas:

  • In the SELECT list of an SQL SELECT statement.
  • In the search condition of a SELECT, UPDATE, MERGE, or DELETE statement.
  • In the SET clause of the UPDATE operation.
  • During the evaluation of an aggregate function.

Parts of exception-type, operation-type, data-type, and position-number might not be returned to the SQL communication area, depending on where the error was detected.

exception-type
Indicates the type of error.

Possible values for exception-type are:

  • FIXED POINT OVERFLOW
  • DECIMAL OVERFLOW
  • ZERO DIVIDE
  • DIVIDE EXCEPTION
  • EXPONENT OVERFLOW
  • INVALID OPERATION
  • SUBNORMAL
  • UNDERFLOW
  • OVERFLOW
  • OUT OF RANGE
operation-type
Indicates the operation that was being performed at the time of the error. Possible operation-type includes the following arithmetic operations:
  • ADDITION
  • SUBTRACTION
  • MULTIPLICATION
  • DIVISION
  • NEGATION

operation-type might also be one of the following operations:

  • A built-in function
  • An aggregate function
  • Java conversion
data-type
The data types of the items being manipulated.

Possible values for data-type include the following data types:

  • BIGINT
  • INTEGER
  • SMALLINT
  • DECIMAL
  • FLOAT

The data type displayed in the message might indicate the data type of the temporary internal copy of the data, which can differ from the actual column or literal data type due to conversions by DB2®.

position-number
The position of the expression in a SELECT list if the error was in the SELECT list of an outer SELECT statement.

System action

The statement cannot be processed. In the case of an insert or update operation, no data is updated or deleted. If the statement was a cursor-controlled FETCH, the cursor will remain open unless the exception occurred while processing an aggregate function (indicated by operation-type of AGGREGATE FUNCTION), in which case the cursor will be closed. If the cursor is closed, subsequent attempts to use that cursor without first doing an OPEN for it receive an SQLCODE -501. If the statement was a cursor-controlled OPEN, the cursor will remain closed.

Programmer response

Examine the SQL statement to see if the cause of the problem can be determined. The problem might be data-dependent, in which case it will be necessary to examine the data that was being processed at the time the error occurred.

If the arithmetic expression in error was within the SELECT list of the outer SELECT statement, it is advisable to include an indicator variable for all expressions in the SELECT list. This allows processing to continue so that non-error column and expression values can be returned.

See the explanation of SQLCODE -405 for allowed ranges of numeric data types.

Problem determination

A fixed point overflow can occur during any arithmetic operation on BIGINT, INTEGER, or SMALLINT fields.

A divide exception can occur on a decimal division operation when the quotient exceeds the specified data field size. A zero divide occurs on a division by zero.

An exponent overflow can occur when the result characteristic of any floating-point operation exceeds 127 and the result fraction is not zero, for example, the magnitude of the result exceeds approximately 7.2E+75.

A decimal overflow exception can occur under either of the following circumstances:

  • One or more non-zero digits are lost because the destination field in any decimal operation is too short to contain the result.
  • A Java stored procedure or user-defined function sets a decimal value in an output parameter that has a precision or scale too small for the value. operation-type is Java conversion. data-type is DECIMAL. position-number indicates which parameter of the CALL statement or user-defined function invocation is in error.

Any of the exception or overflow conditions can occur during the processing of a built-in function. If the operation-type is FUNCTION, the error occurred while processing either an input, intermediate, or final value. The exception can occur because the value of a parameter is out of range.

SQLSTATE

22012 if ZERO DIVIDE.

22003 if other than ZERO DIVIDE.

End of change