一个数字转换为英文的函数时,对其中的to_char和to_date函数不是很理解,经过调试,这个程序的做法是正确的.
举例来说:
运行select to_char(to_date('911','J'),'Jsp') as a from dual
显示结果为:Nine Hundred Eleven
而运行select to_date('911','J') as a from dual
显示结果为:0000-0-0
J:Julian day; the number of days since January 1, 4712 BC. Number specified with 'J' must be integers.
SP:Spelled Number
他的做法是先把数字转为一个数字,然后再转换回来,加上SP,就可以拼写出这个数字了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/77580/viewspace-212678/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/77580/viewspace-212678/