The FLOOR is an inbuilt function in PLSQL which is used to return the largest integer value which will be either equal to or less than from a given input number.
Syntax:
FLOOR(number)
Parameters Used:
This function accepts a parameter number which is the input number on which FLOOR function is called.
Return Value:
This function returns the largest integer value which will be either equal to or less than from a given input number.
Supported Versions of Oracle/PLSQL:
- Oracle 12c
- Oracle 11g
- Oracle 10g
- Oracle 9i
- Oracle 8i
Let’s see some examples which illustrate the FLOOR function:
Example-1:
DECLARE
Test_Number number1 := 2.6;
BEGIN
dbms_output.put_line(FLOOR(Test_Number number1));
END;
Output:
2
In the above example, some parameter is taken. Like 2.6 is taken as the parameter and 2 is returned because 2 is the greatest whole number less than 2.6
Example-2:
DECLARE
Test_Number number1 := -2.6;
BEGIN
dbms_output.put_line(FLOOR(Test_Number number1));
END;
Output:
-3
In the above example, some parameter is taken. In the above example, -2.6 is taken as the parameter and -3 is returned because -3 is the greatest whole number less than -2.6
Advantage:
This function is used to find out the largest integer value which will be either equal to or less than from a given input number.
Last Updated :
19 Feb, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...