Name
FLOOR
Synopsis
The FLOOR function returns the largest integer less than an input value that you specify.
SQL2003 Syntax
All platforms support the SQL2003 syntax:
FLOOR( expression
)
Examples
When you pass a positive number, the effect of FLOOR is to eliminate anything after the decimal point:
SELECT FLOOR(100.1) FROM dual;
FLOOR(100.1)
------------
100
Remember, though, that with negative numbers, going in the “less than” direction corresponds to increasingly larger absolute values:
SELECT FLOOR(-100.1) FROM dual;
FLOOR(-100.1)
-------------
-101
Use CEIL to get behavior opposite to FLOOR.
Get SQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.