FLOOR

The FLOOR function returns the largest integer value that is less than or equal to the argument.

Read syntax diagram
>>-FLOOR(numeric-expression)-----------------------------------><

The schema is SYSIBM.

The argument must be an expression that returns a value of any built-in numeric data type.

Start of changeThe argument can also be a character string or graphic string data type. The string input is implicitly cast to a numeric value of DECFLOAT(34).End of change

The result of the function has the same data type and length attribute as the argument. When the argument is DECIMAL, the scale of the result is 0 and not the scale of the input argument. For example, an argument with a date type of DECIMAL(5,5) results in DECIMAL(5,0).

The result can be null; if the argument is null, the result is the null value.

Example 1: Using sample table DSN8A10.EMP, find the highest monthly salary, rounding the result down to the next integer. The SALARY column has a decimal data type.
   SELECT FLOOR(MAX(SALARY)/12)
     FROM DSN8A10.EMP;
This example returns 04395 because the highest paid employee is Christine Haas who earns $52750.00 per year. Her average monthly salary before applying the FLOOR function is 4395.83.
Example 2: This example demonstrates using FLOOR with both positive and negative numbers.
   SELECT FLOOR( 3.5),
          FLOOR( 3.1),
          FLOOR(-3.1),
          FLOOR(-3.5)
   FROM SYSIBM.SYSDUMMY1;
This example returns (leading zeros are shown to demonstrate the precision and scale of the result):
 03. 03. -04. -04.