漢字轉拼音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
- C#中漢字轉拼音C#
- iOS漢字轉拼音的方法iOS
- ORACLE SQL函式中文漢字轉拼音首字母OracleSQL函式
- [轉]SQL獲取漢字拼音首字母函式SQL函式
- js漢字轉換為拼音功能JS
- JavaPinyin4j(漢字轉拼音)JavaAPI
- php 漢字轉換成拼音 程式PHP
- Python 漢字轉拼音的庫--- PyPinyinPython
- oracle 外部表 漢字轉換為拼音Oracle
- ThinkPHP 漢字轉成多種形式拼音PHP
- python3實現漢字轉拼音Python
- 取漢字的拼音首字母的SQL函式SQL函式
- Hanlp漢字轉拼音使用python呼叫詳解HanLPPython
- C#漢字拼音檢索C#
- js 漢字按照拼音排序效果JS排序
- 漢字之美,拼音之韻
- php獲取漢字的拼音 拼音首字母PHP
- JavaScript 漢字與拼音互轉終極方案 附JS拼音輸入法JavaScriptJS
- C# 漢字轉拼音 使用微軟的Visual Studio International Pack 類庫提取漢字拼音首字母C#微軟
- JavaScript按照漢字拼音順序排序JavaScript排序
- oralce中漢字轉為拼音首字母的函式(轉)函式
- js將漢字轉換為拼音程式碼例項JS
- mysql按照漢字拼音進行order by排序MySql排序
- DB2中建立漢字拼音首字母的SQL函式DB2SQL函式
- Sql Server資料庫漢字按字母、筆劃、拼音首字母、排序SQLServer資料庫排序
- Android環境下hanlp漢字轉拼音功能的使用介紹AndroidHanLP
- Java下將漢字轉換為拼音的包pinyin4jJava
- 如何讓漢字以拼音字母順序排序排序
- 小談漢字轉換成拼音輔助函式和輔助類函式
- 在Excel中如何獲取漢字拼音首字母?Excel
- 簡單方法在C#中取得漢字的拼音的首字母(轉)C#
- SQL&PL/SQL (轉)SQL
- java 漢字轉配音Java
- 在vc中實現獲取漢字拼音的首字母
- 【PL/SQL】向表中插入連續數字之PL/SQL方法SQL
- 使用多執行緒查詢百萬條使用者資料將漢字轉化成拼音執行緒