8.4.3 FLOOR
Returns the greatest integer that is equal to or less than the value of the target data.
- Organization of this subsection
(1) Specification format
scalar-function-FLOOR ::= FLOOR(target-data) target-data ::= value-expression
(2) Explanation of specification format
- target-data:
-
Specifies the numeric data to be processed.
The following rules apply:
-
Specify the target data in the form of a value expression. For details about value expressions, see 7.21 Value expression.
-
Specify numeric data for the target data. For details about numeric data, see (1) Numeric data in 6.2.1 List of data types.
-
You cannot specify a dynamic parameter by itself for the target data.
-
(3) Rules
-
The data type of the execution result is shown in the following table.
Table 8‒3: Data type of the execution result of the scalar function FLOOR Data type of the target data
Data type of the execution result
BIGINT
BIGINT#
INTEGER
INTEGER
SMALLINT
SMALLINT
DECIMAL(p,s)
DECIMAL(p,0)
NUMERIC(p,s)
DOUBLE PRECISION
DOUBLE PRECISION
FLOAT
REAL
REAL
- #
-
If the integer data type format is a legacy format, it will be an INTEGER type.
-
The NOT NULL constraint does not apply to the value of the execution result (the null value is allowed).
-
If the target data is a null value, the execution result will be a null value.
(4) Example
- Example:
-
Determine the greatest integer that is equal to or less than the value of column C1 in table T1, and similarly for columns C2 and C3.
SELECT FLOOR("C1"),FLOOR("C2"),FLOOR("C3") FROM "T1"