Topic: SQL*Plus and PL/SQL >> difference between ceil and floor function
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| Title: difference between ceil and floor function |
| muzu |
Posted: Aug 31, 2007 03:07:12 AM |
Total Post: 37
Joined: Aug, 2007
|
| What is the basic difference between the ceil and floor functions when negative numbers are used in the functions ? |
|
|
Nehru |
| Posted: Aug 31, 2007 08:13:44 AM | |
|
Total Post: 46
Joined: Jul, 2007
|
Hi,
Thae CEIL function will give the Highest value of the given number
where as FLOOR function will give the lowest value to the given Number
see the Examples:
SQL> select ceil(23.4) from dual;
CEIL(23.4)
----------
24
SQL> select ceil(23.8) from dual;
CEIL(23.8)
----------
24
-- what ever the value 23.4 or 23.8 it will give Higher value
SQL> select floor(23.8) from dual;
FLOOR(23.8)
-----------
23
-- what ever the value 23.4 or 23.8 it will give Lower value
SQL> select ceil(-23.4) from dual;
CEIL(-23.4)
-----------
-23
SQL> select floor(-23.4) from dual;
FLOOR(-23.4)
------------
-24
That logic similar to -ve values,
Any one let me know if am wrong.
Take Care
Bye
Nehru
|
|
|
|
|
satyam |
| Posted: Aug 31, 2007 12:18:44 PM | |
|
Total Post: 1
Joined: Apr, 2007
|
Hi,
CIEL(data) function returns the smallest integer value greater than or equal to data.
e.g
sql> select ceil(123.55) from dual;
124
sql> select ceil(32.1) from dual;
33
sql> select ceil(22.05) from dual;
23
sql> select ceil(-22.70) from dual;
-22
sql> select ceil(-22.05) from dual;
-22
sql select ceil(22) from dual;
22
FLOOR(data): It returns the largest integer less than or equal to data.
E.g
sql> select floor(123.55) from dual;
123
sql> select floor(123.99) from dual;
123
sql> select floor(-123.99) from dual;
124
sql> select floor(-123.01) from dual;
-124
Thanks & Regards,
Satyam
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Gopu Gopi | 334 |
| Gitesh Trivedi | 322 |
| Vinoth Kumar | 264 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|