Single-row numeric functions of ORACLE Functions

Source: Internet
Author: User
Tags acos asin natural logarithm

1. ABS (X)

Returns the absolute value of X.

SQL> select abs (-1) A, ABS (1) B, ABS (0) C FROM DUAL;

A B C

------------------------------

1 1 0

2. ACOS (X)

Returns the arc cosine of X.

SQL> select acos (0) A, ACOS (0.5) B, ACOS (1) C FROM DUAL;

A B C

------------------------------

1.570796321.0116755 0

3. ASIN (X)

Returns the arc sine of X.

SQL> select asin (0) A, ASIN (0.5) B, ASIN (1) C FROM DUAL;

A B C

------------------------------

0 0.52359877 1.57079632

4. ATAN (X)

Returns the arc tangent of X.

SQL> select atan (0) A, ATA (0.5) B, ATAN (1) C FROM DUAL;

A B C

------------------------------

0 0.46364760 0.78539816

5. ATAN2 (X, Y)

Returns the arc tangent of number X divided by Y. Y cannot be 0.

SQL> SELECT ATAN2 (3, 4) A FROM DUAL;

A

----------

0.64350110

6. CEIL (X)

Returns the smallest integer greater than or equal to X.

SQL> select ceil (0) A, CEIL (-0.5) B, CEIL (0.5) C, CEIL (5) D, CEIL (-5) E FROM DUAL;

A B C D E

--------------------------------------------------

0 0 1 5-5

7. COS (X)

Returns the cosine of X.

Example:

SQL> select cos (0) A, COS (45) B, COS (90) C FROM DUAL;

A B C

------------------------------

1 1 0.52532198-0.4480736

8. COSH (X)

Returns the double cosine of X.

Example:

SQL> select cosh (0) A, COSH (45) B, COSH (90) C FROM DUAL;

A B C

------------------------------

1 1.74671355 6.10201647

9. EXP (X)

Returns the X power of e.

Example:

SQL> select exp (0) A, EXP (1) B, EXP (10) C FROM DUAL;

A B C

------------------------------

1 2.71828182 22026.4657

10. FLOOR (X)

Returns the largest integer less than or equal to X.

Example:

SQL> select floor (0) A, FLOOR (-1.5) B, FLOOR (-1) C, FLOOR (1.5) D, FLOOR (2) E FROM DUAL;

A B C D E

--------------------------------------------------

0-2-1 1 2

11. LN (X)

Returns the natural logarithm of X. X cannot be 0.

Example:

SQL> select ln (1) A, LN (45) B FROM DUAL;

A B

--------------------

0 3.80666248

12. LOG (Y, X)

Returns the base-Y logarithm of X. Y cannot be 0.

Example:

SQL> select log (10, 5) A, LOG (10, 20) B, LOG (10, 10) C FROM DUAL;

A B C

------------------------------

0.698970001.30102999 1

13. MOD (Y, X)

Returns the remainder after dividing Y by X. If X is 0, returns Y.

Example:

SQL> select mod (10) A, MOD (10, 5) B, MOD (10, 0) C, MOD (10, 20) D FROM DUAL;

A B C D

----------------------------------------

0 0 10 10

14. POWER (Y, X)

Returns the X power at the bottom of Y. Y and X can be any number, but if Y is negative, X must be a positive number.

Example:

SQL> select power (2, 3) A, POWER (-2, 3) B, POWER (2,-3) C FROM DUAL;

A B C

------------------------------

8-8 0.125

15. ROUND (X [, Y])

Note: perform the rounding operation. If Y is omitted, It is rounded to the integer. If Y is negative, it is Y before the decimal point. If Y is positive, it is Y after the decimal point.

Example:

SQL> select round (123.4567) A, ROUND (123.4567, 3) B, ROUND (123.4567,-1) C FROM DUAL;

A B C

------------------------------

123 123.457 120

16. SIGN (X)

Description: Checks positive and negative values of X. If the value is less than 0,-1 is returned. If X is equal to 0, 0 is returned. If X is greater than 0, 1 is returned.

Example:

SQL> select sign (-100) A, SIGN (0) B, SIGN (100) C FROM DUAL;

A B C

------------------------------

-1 0 1

17. SIN (X)

Returns the sine of X.

Example:

SQL> select sin (0) A, SIN (45) B, SIN (90) C FROM DUAL;

A B C

------------------------------

0 0.85090352 0.89399666

18. SINH (X)

Returns the double Sine of X.

Example:

SQL> select sinh (0) A, SINH (45) B, SINH (90) C FROM DUAL;

A B C

------------------------------

0 1.74671355 6.10201647

19. SQRT (X)

Returns the square root of X. X must be greater than or equal to 0.

Example:

SQL> select sqrt (0) A, SQRT (1) B, SQRT (2) C FROM DUAL;

A B C

------------------------------

0 1 1.41421356

20. TAN (X)

Returns the tangent of X.

Example:

SQL> select tan (0) A, TAN (45) B, TAN (90) C FROM DUAL;

A B C

------------------------------

0 1.61977519-1.9952004

21. TANH (X)

Returns the double positive tangent of X.

Example:

SQL> select tanh (0) A, TANH (45) B, TANH (90) C FROM DUAL;

A B C

------------------------------

0 1 1

22. TRUNC (X [, Y])

Description: truncate a number. If Y is omitted, the fractional part of X is truncated. If Y is a negative number, Y is taken before the decimal point. If Y is a positive number, Y is taken after the decimal point.

Example:

SQL> select trunc (123.4567) A, TRUNC (123.4567,-2) B, TRUNC (123.4567, 2) C FROM DUAL;

A B C

------------------------------

123 100 123.45

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.