Oracle numeric Functions

Source: Internet
Author: User

Oracle numeric Functions
Number function 1, integer function (ceil rounded up and floor rounded down) select ceil (66.6) N1, floor (66.6) N2 from dual; 2, power) and evaluate the square root (sqrt) select power (3, 2) N1, sqrt (9) N2 from dual; 3, obtain the remainder select mod (9, 5) from dual; 4, returns a fixed number of decimal places (round: rounding, trunc: truncation) select round (66.667, 2) N1, trunc (66.667, 2) N2 from dual; 5, sign of the return value (positive number returns 1, negative number is-1) select sign (-32), sign (293) from dual; other functions 1. user: return the Login user Name select user from dual; 2. vsize: return the number of bytes required by the expression select vsize ('hello') from dual; 3.nvl( ex1, ex2): If the ex1 value is null, ex2 is returned, otherwise, ex1 (commonly used) is returned. For example, if an employee does not have a commission, 0 is displayed. Otherwise, select comm, nvl (comm, 0) from emp; 4 is displayed. nullif (ex1, ex2): returns NULL if the value is equal; otherwise, returns the first value. For example, if the salary and Commission are equal, null is displayed; otherwise, select nullif (sal, comm ), sal, comm from emp; 5. coalesce: returns the first non-empty expression select comm, sal, coalesce (comm, sal, sal * 10) from emp; 6. nvl2 (ex1, ex2, ex3): If ex1 is not blank, ex2 is displayed; otherwise, ex3 is displayed. For example, view the name of an employee with a Commission and their Commission select nvl2 (comm, ename, ') as HaveCommName, comm from emp;

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.