Oracle's round function

Source: Internet
Author: User

Round function Usage:

Intercept numbers
The format is as follows: ROUND (Number[,decimals])
Where number is to be intercepted
Decimals indicates the number of digits that need to be retained after the decimal point. Optional, ignore it to truncate all the decimal parts, and rounded. A negative number indicates the digits to the left of the decimal points, the corresponding integer number is filled with 0, and the decimal is removed. It should be noted that, unlike the trunc function, the intercepted number is rounded.
Examples are as follows:

SQL code:

Sql> Select Round (1234.5678,4) from dual;

ROUND (1234.5678,4)
——————
1234.5678

Sql> Select Round (1234.5678,3) from dual;

ROUND (1234.5678,3)
——————
1234.568

Sql> Select Round (1234.5678,2) from dual;

ROUND (1234.5678,2)
——————
1234.57

Sql> Select Round (1234.5678,1) from dual;

ROUND (1234.5678,1)
——————
1234.6

Sql> Select Round (1234.5678,0) from dual;

ROUND (1234.5678,0)
——————
1235

Sql> Select Round (1234.5678,-1) from dual;

ROUND (1234.5678,-1)
——————-
1230

Sql> Select Round (1234.5678,-2) from dual;

ROUND (1234.5678,-2)
——————-
1200

Sql> Select Round (1234.5678,-3) from dual;

ROUND (1234.5678,-3)
——————-
1000

Additional:

Sql> Select Round (45.923,-1) from dual;

ROUND (45.923,-1)
——————-
50

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.