漢字轉拼音pl/sql
遺憾的是隻有到千萬,,,
create or replace function getBigMoneyStr(money In number) return varchar2 is
tmp_str varchar2(20);
money_str varchar2(20);
val_j nvarchar2(40);
len_j number;
k number;
i number;
j number;
m number;
result varchar2(40);
type my_type is varray(20) of varchar2(4);
num constant my_type := my_type('1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'0');
num_str constant my_type := my_type('壹',
'貳',
'叄',
'肆',
'伍',
'陸',
'柒',
'捌',
'玖',
'零');
begin
tmp_str := to_char(money * 100);
len_j := length(tmp_str);
k := 11 - len_j;
result := substr(tmp_str, 1, 1);
m := 2;
for i in 1 .. len_j loop
begin
if k = 1 then
money_str := '仟';
elsif k = 2 then
money_str := '佰';
elsif k = 3 then
money_str := '拾';
elsif k = 4 then
money_str := '萬';
elsif k = 5 then
money_str := '仟';
elsif k = 6 then
money_str := '佰';
elsif k = 7 then
money_str := '拾';
elsif k = 8 then
money_str := '元';
elsif k = 9 then
money_str := '角';
elsif k = 10 then
money_str := '分';
end if;
k := k + 1;
m := i + 1;
val_j := nvl(substr(tmp_str, m, 1), '');
if len_j = m + 5 and substr(result, length(result), 1) = '0' then
result := substr(result, 0, length(result) - 1) || '萬0';
end if;
if len_j = m + 1 and substr(result, length(result), 1) = '0' then
result := substr(result, 0, length(result) - 1) || '元0';
end if;
if val_j = '0' and substr(result, length(result), 1) = '0' then
goto TheEnd;
end if;
if substr(result, length(result), 1) != '0' then
result := result || money_str;
end if;
result := result || val_j;
<>
null;
end;
end loop;
--除去最後的0
for j in 1 .. 3 loop
begin
if substr(result, length(result), 1) = '0' then
result := substr(result, 0, length(result) - 1);
end if;
end;
end loop;
for i in 1 .. 10 loop
result := replace(result, num(i), num_str(i));
end loop;
return result || '整';
end;
create or replace function getBigMoneyStr(money In number) return varchar2 is
tmp_str varchar2(20);
money_str varchar2(20);
val_j nvarchar2(40);
len_j number;
k number;
i number;
j number;
m number;
result varchar2(40);
type my_type is varray(20) of varchar2(4);
num constant my_type := my_type('1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'0');
num_str constant my_type := my_type('壹',
'貳',
'叄',
'肆',
'伍',
'陸',
'柒',
'捌',
'玖',
'零');
begin
tmp_str := to_char(money * 100);
len_j := length(tmp_str);
k := 11 - len_j;
result := substr(tmp_str, 1, 1);
m := 2;
for i in 1 .. len_j loop
begin
if k = 1 then
money_str := '仟';
elsif k = 2 then
money_str := '佰';
elsif k = 3 then
money_str := '拾';
elsif k = 4 then
money_str := '萬';
elsif k = 5 then
money_str := '仟';
elsif k = 6 then
money_str := '佰';
elsif k = 7 then
money_str := '拾';
elsif k = 8 then
money_str := '元';
elsif k = 9 then
money_str := '角';
elsif k = 10 then
money_str := '分';
end if;
k := k + 1;
m := i + 1;
val_j := nvl(substr(tmp_str, m, 1), '');
if len_j = m + 5 and substr(result, length(result), 1) = '0' then
result := substr(result, 0, length(result) - 1) || '萬0';
end if;
if len_j = m + 1 and substr(result, length(result), 1) = '0' then
result := substr(result, 0, length(result) - 1) || '元0';
end if;
if val_j = '0' and substr(result, length(result), 1) = '0' then
goto TheEnd;
end if;
if substr(result, length(result), 1) != '0' then
result := result || money_str;
end if;
result := result || val_j;
<
null;
end;
end loop;
--除去最後的0
for j in 1 .. 3 loop
begin
if substr(result, length(result), 1) = '0' then
result := substr(result, 0, length(result) - 1);
end if;
end;
end loop;
for i in 1 .. 10 loop
result := replace(result, num(i), num_str(i));
end loop;
return result || '整';
end;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22392018/viewspace-714443/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 漢字轉漢語拼音
- C#漢字轉漢語拼音C#
- JS 漢字轉換拼音JS
- ORACLE SQL函式中文漢字轉拼音首字母OracleSQL函式
- C#中漢字轉拼音C#
- xpinyin:漢字轉換為拼音庫
- Python 漢字轉拼音的庫--- PyPinyinPython
- Hanlp漢字轉拼音使用python呼叫詳解HanLPPython
- 漢字之美,拼音之韻
- C#漢字拼音檢索C#
- JavaScript按照漢字拼音順序排序JavaScript排序
- js 漢字陣列按拼音排序JS陣列排序
- Android環境下hanlp漢字轉拼音功能的使用介紹AndroidHanLP
- PL/SQL Developer下載地址和漢化包地址SQLDeveloper
- 在Excel中如何獲取漢字拼音首字母?Excel
- java 漢字轉配音Java
- PL/SQL 宣告SQL
- Oracle PL/SQLOracleSQL
- 使用多執行緒查詢百萬條使用者資料將漢字轉化成拼音執行緒
- 如何在PL/SQL中讀寫檔案(轉)SQL
- pl/sql to_dateSQL
- PL/SQL 運算子SQL
- PL/SQL 條件SQL
- PL/SQL 迴圈SQL
- PL/SQL 遊標SQL
- 阿拉伯-漢字-數字轉換
- PHP 將數字轉換為漢字PHP
- win10拼音打不出漢字怎麼辦 win10電腦輸入法打不出漢字如何解決Win10
- 漢語言處理工具pyhanlp的拼音轉換與字元正則化HanLP字元
- utils公共方法:將數字轉為漢字
- JS 中文轉拼音JS
- 直播原始碼開發,vue漢字獲取字母首拼或拼音、大小寫原始碼Vue
- Oracle PL/SQL塊簡介OracleSQL
- ultraedit高亮顯示pl/sqlSQL
- HTML5:給漢字加拼音?收起展開元件?讓我秀給你看HTML元件
- Oracle 的PL/SQL語言使用OracleSQL
- PL/SQL 條件控制語句SQL
- PL/SQL程式設計急速上手SQL程式設計
- Python 漢字區位碼、字串 相互轉換Python字串