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;