Numeric literals allow you to use numeric values to specify the fixed number and floating-point number values.
Integer literals
If integers appear in expressions, conditions, SQL functions, and SQL statements, you must use integer literals to specify values.
The following integer literals are valid:
8
+186
-15
Number literals and floating-point literals
If numbers appear in expressions, conditions, SQL functions, and SQL statements, you must use number or floating-point literals to specify values.
The following number literals are valid:
12
+6.87
0.5
25e-03
-9
The following floating-point literals are valid:
25f
+6.34F
0.5d
-1D
A number literal can store a number whose maximum precision is 38 digits. If a literal requires a higher precision than that provided by NUMBER, BINARY_FLOAT, or BINARY_DOUBLE, ApsaraDB for OceanBase truncates the value. If the range of the literal exceeds the range that is supported by NUMBER BINARY_FLOAT, or BINARY_DOUBLE, ApsaraDB for OceanBase reports an error.
Examples
The decimal point delimiter in a numeric literal is always a dot (.). If you specify a text literal in a position where a numeric literal is expected, the text literal is converted to a numeric literal.
In the following example, 2 is multiplied by the numeric literal 2.2 and 2 is multiplied by the text literal '3.3' :
SELECT 2*2.2, 2*'3.3' FROM DUAL;
The following result is returned:
+-------+---------+
| 2*2.2 | 2*'3.3' |
+-------+---------+
| 4.4 | 6.6 |
+-------+---------+