![]() Using 9s in this case, resulted in a radix character, but no decimal places. ![]() If I don’t want the trailing zeros, I can change the 0 characters to 9s. ![]() The reason I used zeros after the decimal character, is to provide trailing zeros if required. In this case the original number has more than two decimal places, and so the result simply truncates it to the specified number of zeros that follow the decimal/radix character ( D) in the format model. Here’s an example that uses the TO_CHAR(number) function: SELECT TO_CHAR(1.2345, 'fm99D00') Or you can use functions like ROUND(number) and TRUNC(number) to round or truncate the number to your required number of decimal places. When using Oracle Database, you can use functions like TO_CHAR(number) to return numbers as a string, formatted to two decimal places (or however many decimal places you require).
0 Comments
Leave a Reply. |