Oracle BASICS (12) mathematical functions, oracle basics mathematical functions
Mathematical functions:
ABS (n): returns the absolute value.
Select abs (-15), ABS (15) from dual; -- get the absolute value of 15 results: 15, 15
BITAND (X, Y): returns the bitwise AND (AND) of x and y.
Select bitand (1100,101), BITAND () from dual; -- return to x, result of the bitwise AND (AND) operation on y: 0, 0, 64
CEIL (n): rounded up
Select ceil (44.123), CEIL (-44.123) FROM dual; -- rounded up: 45,-44
FLOOR (n): round down
Select floor (44.567), FLOOR (-44.567) FROM dual; -- round down result: 44,-45
ROUND (m, n): Rounding
Select round (44.567), ROUND (44.123), ROUND (-44.123), ROUND (-44.567) FROM dual; -- rounding result: 45, 44,-44, -45 SELECT Round (44.567, 2) FROM dual; -- rounding, retain two decimal places: 44.57
TRUNC (m, n): TRUNC
Select trunc (44.567), TRUNC (44.123), TRUNC (-44.123), TRUNC (-44.567) FROM dual; -- truncation result:,-44, -44 select trunc (44.567, 2) FROM dual; -- truncation result: 44.56
SIGN (n): Get the symbol
Select sign (-19) FROM dual; -- Take the symbol, positive number is 1, negative number is-1, 0 is 0 result:-1
SIN (n): sine
Select sin (3) from dual; -- returns the sine of 3: 0.141120008059867
COS (n): cosine
Select cos (3) from dual; -- returns the cosine of 3:-0.989992496600445
POWER (m, n): n times of m
Select power (256) from dual; -- the 8th POWER of 2 result:
SQRT (n): Square Root
Select sqrt (9) FROM dual; -- square root result: 3
MOD (m, n): Remainder
Select mod () FROM dual; -- 10 mod 2 (remainder) Result: 1