format: To_char (Number,format) that is to_char (numeric, format)
Usage: 1, the TO_CHAR function that does not specify the format converts the numeric value to a simple string form.
Example: To_char (123) Results 123
To_char (-123) Results-123
2, with the format of element 9
Example: To_char (1234, ' 9999 ') results 1234
To_char (567, ' 9999 ') results 567
To_char (-567, ' 9999 ') results-567
To_char (1234567, ' 9999 ') results
To_char (45.789, ' 9999 ') results 46
To_char (567, ' 9999.99 ') results 567.00
To_char (-567, ' 9999.99 ') results-567.00
To_char (1234567, ' 9999.99 ') results #######
To_char (45.789, ' 9999.99 ') results 45.79
To_char (567, ' 9,999,999 ') results 567
To_char (-567, ' 9,999,999 ') results-567
To_char (1234567, ' 9,9999,999 ') results 1,234,567
To_char (0.44, ' 9,999,999 ') results 0
3, with the format of the element $
Example: To_char (1234, ' $9999 ') results $1234
To_char (-567, ' $9999 ') results-$567
4, in the format of element b if the integer part of the converted value is 0, it appears as a space
Example: To_char (567, ' B999.9 ') results 567.0
To_char ( -567, ' B999.9 ') results-567.0
To_char (0.44, ' B999.9 ') results. 4
5, with the element MI format negative number is converted to the end with a minus sign
Example: To_char (567, ' 999MI ') results 567
To_char ( -567, ' 999MI ') results 567-
6, with the format of the element s to convert to the number of positive and negative numbers characters
Example: To_char (567, ' S999 ') results +567
To_char ( -567, ' S999 ') results-567
To_char (567, ' 999S ') results 567+
To_char ( -567, ' 999S ') results 567-
7, with the element PR format with angle brackets surround negative numbers
Example: To_char (567, ' 9999PR ') results 567
To_char ( -567, ' 9999PR ') results <567>
8. Insert a decimal point in the specified position with the format of element D
Example: To_char (567, ' 9999d99 ') results 567.00
To_char ( -567, ' 9999d99 ') results-567.00
To_char (567.866, ' 9999d99 ') results 567.87
9. Eeee Scientific Counting method
Example: To_char (567, ' 9.9EEEE ') results 5.7E+02
To_char (9.9EEEE ') results 4.5E+01
To_char (0.0666, ' 9.9EEEE ') results 6.7E-02
To_char function is a good reputation, the conversion function is very strong
The original text from: http://blog.sina.com.cn/s/blog_4cbadf5a0100f7u7.html