Addition and subtraction
If both operands are exact numeric, then adding or subtracting the operands produces
an exact numeric with a precision of 18 and a scale equal to the larger of the two. For
example:
CREATE TABLE t1 (n1 NUMERIC(16,2), n2 NUMERIC(16,3));
INSERT INTO t1 VALUES (12.12, 123.123);
COMMIT;
The following query returns the integer 135.243. The largest scale of the two operands is
3; therefore, the scale of the sum is 3.
SELECT n1 + n2 FROM t1;
Similarly, the following query returns the integer –111.003:
SELECT n1 – n2 FROM t1;
If either of the operands is approximate numeric (
FLOAT
,
REAL
, or
DOUBLE PRECISION
),
then the result is
DOUBLE
PRECISION
.
INTERBASE 6 FEATURES
Do'stlaringiz bilan baham: |