PL/SQL single-row functions and group functions (2)

Source: Internet
Author: User
Tags acos natural logarithm truncated
Single-row numeric Functions

A single-row numeric function operates on numeric data and performs mathematical and arithmetic operations. All functions have numeric parameters and return numeric values. The operands and values of all trigonometric functions are radians rather than degrees. Oracle does not provide built-in radians and angle conversion functions.

  ABS ( )
Returns the absolute value of N.

  ACOs ( )
Returns the number between-1 and 1 in the anti-Yuxuan function. N indicates radians

Select ACOs (-1) PI, ACOs (1) zero from dual

Pi zero

3.14159265 0

  Asin ( )
Returns-1 to 1, and N to indicate radians.

  Atan ( )
Returns the arc tangent value of N. N indicates radians.

  Ceil ( )
Returns the smallest integer greater than or equal to n.

  Cos ( )
Returns the remainder Xuan value of N, and N is a radian.

  Cosh ( )
Returns the hyperbolic remainder of n, where n is a number.

Select cosh (<1.4>) from dual

Cosh (1.4)

2.15089847

  Exp ( )
Returns the N power of E, E = 2.71828183.

  Floor ( )
Returns the largest integer less than or equal to n.

  Ln ( )
Returns the natural logarithm of N. N must be greater than 0.

  Log ( , )
Returns the base N2 logarithm of N1.

  MoD ( )
Returns the remainder of N1 divided by N2,

  Power ( , )
Returns the N2 power of N1.

  Round ( , )
Return the value of N1 rounded to the right of the decimal point. The default value of N2 is 0. This is the nearest integer to the decimal point. If N2 is a negative number, it is rounded to the corresponding digit on the left of the decimal point, n2 must be an integer.

Select round (12345,-2), round (12345.54321, 2) from dual

Round (12345,-2) round (12345.54321, 2)

12300 12345.54

  Sign ( )
If n is negative,-1 is returned. If n is positive, 1 is returned. If n = 0, 0 is returned.

  Sin ( )
Returns the positive and negative values of N, and N is a radian.

  Sinh ( )
Returns the hyperbolic Xuan value of N, which is radian.

  SQRT ( )
Returns the square root of N, and N is a radian.

  Tan ( )
Returns the tangent of N. N is a radian.

  Tanh ( )
Returns the hyperbolic tangent of N. N is a radian.

  Trunc ( , )
Return the N1 value from the ending point to the N2 decimal point. The default value of N2 is 0. When N2 is the default value, the ending point of N1 is an integer. If N2 is a negative value, it is truncated at the right of the decimal point.

  Single Row date functions

A single-row date function operates on data types. The vast majority of data type parameters are available, and the vast majority of returned data types are also values.

  Add_months ( , <I>)
Returns the result after date D plus I months. I can make any integer. If I is a decimal point, the database implicitly converts it to an integer, and the part after the decimal point is truncated.

  Last_day ( )
Returns the last day of the month containing the date D.

  Months_between ( , )
Returns the number of months between D1 and D2. If the date of D1 and D2 is the same, or the last day of the month is used, an integer is returned, otherwise, the returned result contains a score.

  New_time ( , , )
D1 is a date data type. When the date and time in Zone tz1 are d, the date and time in Zone tz2. Tz1 and tz2 are strings.

  Next_day ( , )
Returns the first day of the condition given by Dow after the date D. Dow specifies a day in a week using the language given in the current session, and returns the same time component as the time component of D.

Select next_day ('01-Jan-2000 ', 'monday') "1st Monday", next_day ('01-Nov-2004', 'tuesday') + 7 "2nd Tuesday ") from dual;

1st Monday 2nd Tuesday

03-Jan-2000 09-nov-2004

  Round ( [, ])
Round the date d in the format specified by FMT, and FMT is a string.

  Syadate
The function has no parameters. The current date and time are returned.

  Trunc ( [, ])
Returns the date D of the unit specified by FMT.

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.