Quote:
Any special register need to set?
I think there is no such register variable, because a description for
|
AVG in manual "DB2 SQL Reference" was written like:
If the type of the result is integer, the fractional part of the
average is lost.
So, you may want to use a CEILING function, like this:
------------------------- Commands Entered -------------------------
SELECT avg(i) as avg_i
, sum(i) as sum_i
, CEILING( avg( real(i) ) ) as ceil_avg_i
FROM (values (1), (2) ) t(i)
;
--------------------------------------------------------------------
AVG_I SUM_I CEIL_AVG_I
----------- ----------- ------------------------
1 3 +2.00000000000000E+000
1 record(s) selected.