Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

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

  




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 Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi334
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software