Rounding function in "Go" SQL Floor, ROUND, Ceil, TRUNC, sign

Source: Internet
Author: User
Tags abs

--------------------------------------------------------------------------
1 trunc (value,precision) intercepts a number by precision (precision) and does not perform rounding operations.
2 round (value,precision) Enter a value based on the given precision (precision).
3 Ceil (value) produces the smallest integer greater than or equal to the specified value (value).
4 floor (value), in contrast to Ceil (), produces the smallest integer less than or equal to the specified value (value).
5 sign (value) is opposite to the absolute value function abs (). ABS () gives the amount of the value rather than its symbol, and sign (value) gives the value a symbol rather than a quantity.
--------------------------------------------------------------------------

1, returns the largest integer greater than or equal to x:
Select Ceil (23.33) from dual;

Ceil (23.33)
-----------
24

2, returns the largest integer equal to or less than x:
Select Floor (23.33) from dual;

Floor (23.33)
------------
23

3, returns the x value of the Y-bit rounded to the right of the decimal point: Rcund (X,[y])
Select Round (23.53,2) from dual;

ROUND (23.33)
------------
23

4, return truncated to Y decimal place x Value: Trunc (X,[y])
Select Trunc (23.33123123) from dual;

TRUNC (23.33)
------------
23

5, returns the symbol of X
Select sign ( -23.33) from dual;

Sign (-23.33)
------------
-1

Rounding function in "Go" SQL Floor, ROUND, Ceil, TRUNC, sign

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.