3.3.2 Notes on the DECIMAL and NUMERIC types

If the data for the DECIMAL or NUMERIC types exceeds the specified number of digits, an error occurs.

Also, if the processes described below are performed and the number of digits in the result exceeds the number of digits specified by the query.decimalMaxPrecision property, the result is rounded to the specified number of digits (the values are not rounded if these processes are not executed).

How the value will be rounded and expressed is specified by the query.decimalRoundingMode property. For details about properties, see the uCosminexus Stream Data Platform - Application Framework Setup and Operation Guide.

The following table shows examples of how values are rounded. In these examples, the query.decimalMaxPrecision property is set to 1 (rounding the number of digits to 1).

Table 3-6 Value rounding examples (when query.decimalMaxPrecision=1)

Operation result (number of digits: 2)Value specified in the query.decimalRoundingMode property
UPDOWNCEILINGFLOORHALF_UPHALF_DOWNHALF_EVEN
5.56565656
2.53232322
1.62121222
1.12121111
1.01111111
-1.0-1-1-1-1-1-1-1
-1.1-2-1-1-2-1-1-1
-1.6-2-1-1-2-2-2-2
-2.5-3-2-2-3-3-2-2
-5.5-6-5-5-6-6-5-6

For a numeric constant (decimal constant) in the DECIMAL type (NUMERIC type), the number of digits is not checked. If the value is out of range, it is shown as a value described in CQL, regardless of how the query.decimalMaxPrecision or query.decimalRoundingMode properties are specified.

The following table shows how to specify a digit count for transmitted data, operation results, and numeric constants in the DECIMAL type (NUMERIC type), and what happens if the specified number of digits is exceeded.

Table 3-7 How to specify a digit count in the DECIMAL type (NUMERIC type) and the action taken if the specified number of digits is exceeded

TypeDigit count specification methodAction if the specified number of digits is exceeded
Transmitted dataType name of schema specification character stringIf the digit count is exceeded during data transmission, an error occurs.
Operation result
  • Four arithmetic operations
  • Aggregate function SUM/AVG
  • Casting
query.decimalMaxPrecision propertyThe method specified by the query.decimalRoundingMode property is used to round the digit count so that it matches the digit count specified by the query.decimalMaxPrecision property.
OthersThe operation result is displayed as is (the value is not rounded).
Numeric constant (decimal constant)No specificationShown using the value as it is in CQL.