将数字转换成英文拼写的语句
将数字转换成英文拼写的语句
软件环境
Windows Server 2008 R2
Oracle 11g Release 1 (11.1)
演示将数字转换成英文拼写
SQL> select decode(sign(&num), -1, 'Negative ', 0, 'Zero', NULL) ||
2 decode(sign(abs(&num)), +1, to_char(to_date(abs(&num), 'J'), 'Jsp'))
3 from dual;
输入 num 的值: 1
原值 1: select decode(sign(&num), -1, 'Negative ', 0, 'Zero', NULL) ||
新值 1: select decode(sign(1), -1, 'Negative ', 0, 'Zero', NULL) ||
输入 num 的值: 1
输入 num 的值: 1
原值 2: decode(sign(abs(&num)), +1, to_char(to_date(abs(&num), 'J'), '
Jsp'))
新值 2: decode(sign(abs(1)), +1, to_char(to_date(abs(1), 'J'), 'Jsp'))
DEC
---
One
SQL>
SQL> select decode(sign(&num), -1, 'Negative ', 0, 'Zero', NULL) ||
2 decode(sign(abs(&num)), +1, to_char(to_date(abs(&num), 'J'), 'Jsp'))
3 from dual;
输入 num 的值: 5
原值 1: select decode(sign(&num), -1, 'Negative ', 0, 'Zero', NULL) ||
新值 1: select decode(sign(5), -1, 'Negative ', 0, 'Zero', NULL) ||
输入 num 的值: 5
输入 num 的值: 5
原值 2: decode(sign(abs(&num)), +1, to_char(to_date(abs(&num), 'J'), '
Jsp'))
新值 2: decode(sign(abs(5)), +1, to_char(to_date(abs(5), 'J'), 'Jsp'))
DECO
----
Five
SQL>
SQL> select decode(sign(&num), -1, 'Negative ', 0, 'Zero', NULL) ||
2 decode(sign(abs(&num)), +1, to_char(to_date(abs(&num), 'J'), 'Jsp'))
3 from dual;
输入 num 的值: 25
原值 1: select decode(sign(&num), -1, 'Negative ', 0, 'Zero', NULL) ||
新值 1: select decode(sign(25), -1, 'Negative ', 0, 'Zero', NULL) ||
输入 num 的值: 25
输入 num 的值: 25
原值 2: decode(sign(abs(&num)), +1, to_char(to_date(abs(&num), 'J'), '
Jsp'))
新值 2: decode(sign(abs(25)), +1, to_char(to_date(abs(25), 'J'), 'Jsp'
))
DECODE(SIGN
-----------
Twenty-Five
SQL>