How to operate the ceil function in Oracle Database

Source: Internet
Author: User
Tags floor function

The following content mainly introduces the practical application of the ceil function in Oracle Database to evaluate the smallest integer greater than a certain number, the following is a detailed description of the actual operations. I hope you will gain some benefits after browsing the following content.

 
 
  1. SQL> select ceil(comm),comm from myemp where ename='MORFLAME';  
  2. CEIL(COMM) COMM  
  3. 556 555.55  

Floor function: returns the maximum integer smaller than a certain number.

 
 
  1. SQL> select floor(comm),comm from myemp where ename='MORFLAME';  
  2. FLOOR(COMM) COMM  
  3. 555 555.55  

Mod

 
 
  1. SQL> select mod(12,3) from dual 

The dual table here is a virtual table that is only used to test functions.

MOD (12, 3)

0

Abs, returns the absolute value function.

 
 
  1. SQL> select abs(-3) from dual;  
  2. ABS(-3)  

3

Other mathematical Oracle database functions include cos, cosh, exp, ln, log, sin, sinh, sqrt, tan, tanh, acos, asin, atan ......

Date Functions

Sysdate: returns the system time.

 
 
  1. select sysdate from dual; 

Add_months (d, n): add the date of n months from the date d.

Ask the employees who joined the company 8 months ago:

 
 
  1. select * from myemp where sysdate>add_months(hiredate,8); 

Days of employment:

Select sysdate-hiredate "days of employment", ename from myemp;

Employment days ENAME

10644.4805 SMITH

10579.4805 ALLEN

8073.48059 MORFLAME

Last_day (d): returns the last day of the month of the specified date.

Ask the employees who joined the company on the last three days of this month:

 
 
  1. select ename,hiredate from emp where l
    ast_day(hiredate)-2=hiredate; 

The above content is an introduction to the relevant functions in the Oracle database. I hope you will get some benefits.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.