Mathematical functions of Oracle SQL functions

Source: Internet
Author: User
Tags acos asin cos mathematical functions sin square root truncated

Mathematical functions of Oracle SQL functions

ABS (x) "function" returns the absolute value of x "parameter" x, numeric Expression "return" numeric SQL> SELECT ABS ( -), ABS (- -) from DUAL; ABS ( -) ABS (- -)---------- ---------- -         -Sign (x) "function" returns the positive negative value of X "parameter" x, numeric Expression "return" number, if positive value returns 1, negative value returns-1, 0 returns 0SQL> SELECT sign ( -), sign (- -), sign (0) from DUAL; Sign ( -) Sign (- -) sign (0)---------- ---------- ----------1-1          0ceil (x) "function" returns the smallest integer value greater than or equal to X "parameter" x, numeric Expression "return" numeric SQL> SELECT ceil (3.1), Ceil (1.2+2), Ceil (0) from DUAL; Ceil (3.1) Ceil (1.2+2) Ceil (0)---------- ----------- ----------4           4          0Floor (x) "function" returns the maximum integer value less than or equal to X "parameter" x, numeric Expression "return" numeric SQL> SELECT Floor (3.1), Floor (1.2+2), Floor (0) from DUAL; Floor (3.1) Floor (1.2+2) Floor (0)---------- ------------ ----------3            3          0Power (x, y) "function" returns the Y-power of X "parameter", x, y numeric Expression "return" numeric SQL> SELECT POWER (2,2), POWER (2,3), POWER (2,-1), POWER (2.5,2), POWER (2,0) from DUAL; POWER (2,2) POWER (2,3) POWER (2,-1) POWER (2.5,2) POWER (2,0)---------- ---------- ----------- ------------ ----------4          8         0.5         6.25          1exp (y) "function" returns the Y-power of E (E is a mathematical constant) "parameter" Y, and the numeric expression "returns" the numeric SQL> SELECT EXP (3), EXP (0), EXP (-3) from DUAL; EXP (3) EXP (0) EXP (-3)---------- ---------- ----------20.0855369          1 0.04978706log (x, y) "function" returns the logarithm "parameter" x, y, and y for the bottom of the base, "condition" x, y must be greater than 0 "return" Numeric SQL> SELECT POWER (4,2), LOG ( -,2),1/log ( -,4) from DUAL; POWER (4,2) LOG ( -,2)1/log ( -,4)---------- ---------- ----------- -       0.25           2ln (y) "function" returns the logarithm of the base of Y (e is a mathematical constant) "parameter" y, a numeric expression (condition y>0) "Return" Numeric SQL>SelectExp3), exp (-3), ln (20.0855369), ln (0.049787068) fromdual; EXP (3) EXP (-3) LN (20.0855369) LN (0.049787068)---------- ---------- -------------- ---------------20.0855369 0.04978706 2.999999998845-3.000000007388mod (x, y) "function" returns the remainder of x divided by y "parameter" x, y, numeric expression "return" numeric SQL> SELECT MOD ( at,8), MOD ( -,8) from DUAL; MOD ( at,8) MOD ( -,8)---------- ----------7          0round (X[,y]) "function" returns the rounded value "parameter" x, y, numeric expression, if Y is not an integer then the y integer part is truncated, if y>0 is rounded to the Y decimal place, and if Y is less than 0 rounded to the left of the decimal point. "Return" Digital SQL>SelectRound5555.6666,2.1), round (5555.6666,-2.6), round (5555.6666) fromdual; ROUND (5555.6666,2.1) ROUND (5555.6666,-2.6) ROUND (5555.6666)-------------------- --------------------- ----------------5555.67                  5600             5556trunc (x[,y]) "function" returns the x by the precision y intercept value "parameter" x, y, numeric expression, if Y is not an integer then intercept y integer part, if y>0 is truncated to y decimal places, if Y is less than 0 is truncated to the left of the decimal point, the decimal number before the other data with 0. "Return" Digital SQL>SelectTrunc5555.66666,2.1), Trunc (5555.66666,-2.6), Trunc (5555.033333) fromdual; TRUNC (5555.66666,2.1) TRUNC (5555.66666,-2.6) TRUNC (5555.033333)--------------------- ---------------------- ------------------5555.66                   5500               5555sqrt (x) "function" returns the square root of x "parameter" x-numeric Expression "return" numeric SQL>Selectsqrt -), sqrt (9), sqrt (Ten) fromdual; SQRT ( -) SQRT (9) SQRT (Ten)---------- ---------- ----------8          3 3.16227766Trigonometric Functions: SIN (x) "function" returns the sinusoidal value of a number "example"SelectSin1.57079) fromdual; return:1sigh (x) "function" returns the value of the hyperbolic sine "example"SelectSin -), Sinh ( -) fromdual; return:0.91294525,242582598cos (x) "function" returns the cosine of a given number "example"SelectCos (-3.1415927) fromdual; return:-1COSH (x) "function" returns a numeric inverse cosine "example"SelectCosh -) fromdual; return:242582598Tan "function returns the tangent of a number" example "SelectTan -), Tan (Ten) fromdual; return:2.2371609,0.64836083TANH "function returns the hyperbolic tangent value of the number N" Example "SelectTanh -), Tan ( -) fromdual; return:1,2.2371609ASIN (x) "function" gives the value of the inverse chord "example"SelectAsin0.5) fromdual; return:0.52359878ACOS (x) "function" gives the value of the inverse cosine "example"SelectACOs (-1) fromdual; return:3.1415927ATAN (x) "function" returns the inverse tangent value of a number "example"SelectAtan1) fromdual; return:0.78539816

Mathematical functions of Oracle SQL functions

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.