FLOOR Function
The FLOOR function takes as its argument a numeric expression, or a string that can be converted to a DECIMAL data type, and returns the DECIMAL(32) representation of the largest integer that is smaller than or equal to its single argument.
The following query returns
32
as the
largest integer that is smaller than or equal to the FLOOR argument
of 32.3
: SELECT FLOOR(32.3) FROM systables WHERE tabid = 1;
The next example returns
-33
as the largest
integer that is smaller than or equal to the FLOOR argument
of -32.3
: SELECT FLOOR(-32.3) FROM systables WHERE tabid = 1;These examples illustrate how the FLOOR and CEIL functions provide upper and lower bounds that differ by 1 when they have the same argument that has a nonzero fractional part. For an integer argument, FLOOR and CEIL return the same DECIMAL(32) representation of their argument.