把中文数字转化成阿拉伯数字?有什么好的方法?用sql 语句。

2020-04-29 社会 402阅读
你说的中文数字应该是字符一、二、三……吧?这是字符判断转为数字,可以用DECODE和CASE WHEN 来解决。如:
select decode(table_column,'一',1,'二',2,'三',3,'四',4,'五',5,'六',6,'七',7,'八',8,'九',9,'零',0,'') from (select '六' as table_column from dual) your_table;

select case when table_column = '一' then 1
when table_column = '二' then 2
when table_column = '三' then 3
when table_column = '四' then 4
when table_column = '五' then 5
when table_column = '六' then 6
when table_column = '七' then 7
when table_column = '八' then 8
when table_column = '九' then 9
when table_column = '零' then 0
else null end
from (select '六' as table_column from dual) your_table;
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com