首页 > 代码库 > 将汉字数字字符串转换成阿拉伯数字

将汉字数字字符串转换成阿拉伯数字

 1 declare
 2 
 3 str_mid varchar2(100);
 4 str_end varchar2(100);
 5 begin
 6   
 7 for j in (select t.id,t.ques_desc from  cqdn_qa_list_tmp t) 
 8   loop 
 9 for i in 1 .. length(j.ques_desc)
10 loop
11 
12 case substr(j.ques_desc,i,1) 
13   when  then str_mid:=1 ;
14   when  then str_mid:=2 ;
15   when  then str_mid:=3 ;
16   when  then str_mid:=4 ;
17   when  then str_mid:=5 ;
18   when  then str_mid:=6 ;
19   when  then str_mid:=7 ;
20   when  then str_mid:=8 ;
21   when  then str_mid:=9 ;       
22   when  then str_mid:=0 ;    
23 end case;
24 
25 str_end:=str_end||str_mid;
26 end loop;
27 
28 dbms_output.put_line(str_end);
29 
30 update cqdn_qa_list_tmp t set t.ques_desc = str_end  where t.id = j.id;
31 commit;
32 str_end:=null;
33 end loop;
34 end;

 

将汉字数字字符串转换成阿拉伯数字