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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.