TRUNC (NoSQL 查詢)
適用於:NoSQL
傳回截斷至最接近整數值的數值。
語法
TRUNC(<numeric_expr>)
引數
描述 | |
---|---|
numeric_expr |
數值表達式。 |
傳回類型
傳回數值運算式。
範例
此範例說明將數位截斷到最接近整數的各種方式。
SELECT VALUE {
truncateFloatingPoint: TRUNC(2.37),
truncateNegative: TRUNC(-2.78),
truncateInteger: TRUNC(2),
truncateSmallNumber: TRUNC(0.0000714),
truncatePi: TRUNC(PI())
}
[
{
"truncateFloatingPoint": 2,
"truncateNegative": -2,
"truncateInteger": 2,
"truncateSmallNumber": 0,
"truncatePi": 3
}
]
備註
- 此函式受益於 範圍索引。