Syntax
FORMAT(X,D)
Purpose
You can call this function to convert the number X into the #,###,###.## format, round the value to D decimal places, and return the result as a string.
If the integer part exceeds three digits, commas (,) are used as thousands separators.
If D is 0, the result has no decimal point or fractional part.
Examples
obclient> SELECT FORMAT(12332.123456, 4) FROM DUAL;
+-------------------------+
format(12332.123456, 4)
+-------------------------+
12,332.1235
+-------------------------+
1 row in set (0.00 sec)
obclient> SELECT FORMAT(12332.1, 4) FROM DUAL;
+--------------------+
format(12332.1, 4)
+--------------------+
12,332.1000
+--------------------+
1 row in set (0.01 sec)
obclient> SELECT FORMAT(12332.2, 0) FROM DUAL;
+--------------------+
format(12332.2, 0)
+--------------------+
12,332
+--------------------+
1 row in set (0.00 sec)