1. Origin
When the oracle database field value is less than 1 decimal point, the char type is used for processing, and the 0 before the decimal point is lost.
For example, 0.35 is changed to. 35.
2. Solution: Use the to_char function to format the number display.
Select to_char (0.338, 'fm9999999990. 00') from dual;
Result: 0.34
Here we will focus on fm9999999999.99, which indicates that the integer part can be up to 10 digits, and the fractional part can be 2 digits. fm indicates that the leading space after the index string is removed, without fm, and there will be spaces before 0.34.
3. Use of
WITH TMP1 (
SELECT 1 as a, 2 AS B FROM DUAL
UNION
SELECT 1 as a, 3 AS B FROM DUAL
UNION
SELECT 1 as a, 4 AS B FROM DUAL
),
TMP2 (
SELECT 1 as a, 2 AS B FROM DUAL
UNION
SELECT 1 as a, 3 AS B FROM DUAL
UNION
SELECT 2 as a, 4 AS B FROM DUAL
)
SELECT TMP1. *, TMP2 .*
FROM TMP1 JOIN TMP2
ON TMP1.A = TMP2.A
Author "striving forward"