本文介紹對那些沒有通用數學約定的類型進行數值改變操作(例如,日期/時間類型)的實際動作。
下面的表顯示了允許使用的數學函數。通過使用不同的參數類型,以多種方式使用這些函數。除非特別說明,任何形式的函數都返回和它的參數類型相同的值。對DOUBLE PRECISION類型數據進行操作的函數是在主機系統C程序庫的頂層實現,根據所運行的主機平臺,在界限的精度和系統行為方面是有所不同。
函數 | 返回類型 | 描述 | 示例 | 結果 |
---|---|---|---|---|
ABS(x) | Same as X | Absolute value | ABS(-17.4) | 17.4 |
CEIL(DOUBLE PRECISION or NUMBER) | Same as input | Smallest integer not less than argument | CEIL(-42.8) | -42 |
EXP(DOUBLE PRECISION or NUMBER) | Same as input | Exponential | EXP(1.0) | 2.71828182845904 52 |
FLOOR(DOUBLE PRECISION or NUMBER) | Same as input | Largest integer not greater than argument | FLOOR(-42.8) | 43 |
LN(DOUBLE PRECISION or NUMBER) | Same as input | Natural logarithm | LN(2.0) | 0.69314718055994 53 |
LOG(b NUMBER, X NUMBER) | NUMBER | Logarithm to base b | LOG(2.0, 64.0) | 6.00000000000000 00 |
MOD(y, X) | Same as argument types | Remainder of y/x | MOD(9, 4) | 1 |
NVL(x, y) | Same as argument types; where both arguments are of the same data type | If X is null, then NVL returns y | NVL(9, 0) | 9 |
POWER(a DOUBLE PRECISION, b DOUBLE PRECISION) | DOUBLE PRECISION | a raised to the power of b | POWER(9.0, 3.0) | 729.000000000000 0000 |
POWER(a NUMBER, b NUMBER) | NUMBER | a raised to the power of b | POWER(9.0, 3.0) | 729.000000000000 0000 |
ROUND(DOUBLE PRECISION or NUMBER) | Same as input | Round to nearest integer | ROUND(42.4) | 42 |
ROUND(v NUMBER, s INTEGER) | NUMBER | Round to s decimal places | ROUND(42.4382, 2) | 42.44 |
SIGN(DOUBLE PRECISION or NUMBER) | Same as input | Sign of the argument (-1, 0, +1) | SIGN(-8.4) | -1 |
SQRT(DOUBLE PRECISION or NUMBER) | Same as input | Square root | SQRT(2.0) | 1.41421356237309 5 |
TRUNC(DOUBLE PRECISION or NUMBER) | Same as input | Truncate toward zero | TRUNC(42.8) | 42 |
TRUNC(v NUMBER, s INTEGER) | NUMBER | Truncate to s decimal places | TRUNC(42.4382, 2) | 42.43 |
WIDTH BUCKET( op NUMBER, b1 NUMBER, b2 NUMBER, count INTEGER) | INTEGER | Return the bucket to which op would be assigned in an equidepth histogram with count buckets, in the range b1 to b2 | WIDTH BUCKET(5.35, 0.024, 10.06, 5) | 3 |
下面的表顯示了允許使用的三角函數,所有的三角函數的參數和返回值類型都是DOUBLE PRECISION。
函數 | 描述 |
---|---|
ACOS(x) | Inverse cosine |
ASIN(x) | Inverse sine |
ATAN(x) | Inverse tangent |
ATAN2(x, y) | Inverse tangent of x/y |
COS(x) | Cosine |
SIN(x) | Sine |
TAN(x) | Tangent |