eXtremeSQL understands the standard SQL type
NUMERIC
. It storesNUMERIC
fields internally as 8 byte integer values with a specified width and precision. When performing operations (in SQL statements) on database fields, and converting the resulting values to result set rows, the precision of the result is determined by the following rules (whereP1
andP2
represent the precision of the operands):
Operation Result Precision P1+ P2
max(P1,P2)
P1- P2
max(P1,P2)
P1* P2
P1+P2
P1/ P2
max(P1-P2, 0)
Also, when
NUMERIC
values are compared, the precision of the result ismax(P1,P2)
.