Calculation of numerical values in Oracle

Source: Internet
Author: User

operator meaning

· + (PLUS) Addition | | (plus) string addition · -(minus) subtraction · * (multiply) multiplication · /(Divide) Division · MoD (modulo) returns the integer remainder of a division

For example, 12 5 = 2, which is because 12 is divided by 5 and the remainder is 2


Example:
Select5+6,5+ NULL fromDual
Select5-6 fromDual
Select5*6 fromDual
Select5/6 fromDual
Selectmod(13,3) fromDual

Calculation of columns:

Select field A + Field B form table Select field a*2 form table Power (2,3): 2 3 times
Round (values, decimal digits): 4 in 5
Floor: Fractional part directly discarded, integer unchanged
Ceil: Fractional part directly discarded, integer +1

--2*2*2*2
SelectPower (2,4) fromDual

--Problem (understanding): Ask for value after 8 open root 3
--a*a*a=8,a=?
SelectPower (8,1/3) fromDual

--Rounding:
--The decimal place is 0, which means that after rounding, an integer is returned
SelectRound (0.49) fromDual
SelectRound (0.5) fromDual

--Keep 2 decimal places
SelectRound (0.33333,2) fromDual

--floor: The fractional part is discarded directly and the integer is unchanged
SelectFloor (10.9) fromDual
--ceil: Fractional part directly discarded, integer +1
SelectCeil (10.1) fromDual

Calculation of numerical values in Oracle

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.