日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle 函数 if 判断,oracle 判断中文函数

發(fā)布時間:2023/12/10 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle 函数 if 判断,oracle 判断中文函数 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

create or replace function func_chinese

(

p_str? ???in varchar2,? ???-- 輸入的字符串

p_code? ? in varchar2,? ???-- dump(字符串)

p_chinese in pls_integer? ?-- 1, 提取漢字, 非1, 提取非漢字

) return varchar2

as

v_code? ?? ?? ?varchar2(32767) := substr(p_code,instr(p_code,‘:‘)+2);

v_chinese? ?? ?varchar2(32767) := ‘‘;

v_non_chinese??varchar2(32767) := ‘‘;

v_comma? ?? ???pls_integer;

v_code_h? ?? ? pls_integer;

v_code_l? ?? ? pls_integer;

begin

if p_str is not null then

for i in 1..length(p_str) loop

if lengthb(substr(p_str,i,1))=2 then

v_comma??:= instr(v_code,‘,‘);

v_code_h := to_number(substr(v_code,1,v_comma-1));

v_code_l := to_number(substr(v_code,v_comma+1,abs(instr(v_code,‘,‘,1,2)-v_comma-1)));

if (v_code_h>=176 and v_code_h<=247 and v_code_l>=161 and v_code_l<=254) or

(v_code_h>=129 and v_code_h<=160 and v_code_l>=64??and v_code_l<=254??and nvl(v_code_l,127)!=127) or

(v_code_h>=170 and v_code_h<=254 and v_code_l>=64??and v_code_l<=160??and nvl(v_code_l,127)!=127) then

v_chinese := v_chinese||substr(p_str,i,1);

else

v_non_chinese := v_non_chinese||substr(p_str,i,1);

end if;

v_code := ltrim(v_code,‘1234567890‘);

v_code := ltrim(v_code,‘,‘);

else

v_non_chinese := v_non_chinese||substr(p_str,i,1);

end if;

v_code := ltrim(v_code,‘1234567890‘);

v_code := ltrim(v_code,‘,‘);

end loop;

if p_chinese = 1 then

return v_chinese;

else

return v_non_chinese;

end if;

else

return ‘‘;

end if;

end;

/

SQL> select * from t;

NAME

----------------------

新年快樂X

狿X

199

春天會來的

-----------------------

實驗1: 提取漢字

-----------------------

select name,func_chinese(name,dump(name),1) result from t;

NAME? ?? ?? ?? ?? ?? ?? ?? ?? ?RESULT

------------------------------ -----------

新年快樂X? ?? ?? ?? ?? ?? ?? ? 新年快樂

狿X? ?? ?? ?? ?? ?? ?? ?? ?? ? 狿

狿? ?? ?? ?? ?? ?? ?? ?? ?? ???狿

199

春天會來的? ?? ?? ?? ?? ?? ?? ?春天會來的

-----------------------

實驗2: 提取非漢字

-----------------------

select name,func_chinese(name,dump(name),0) result from t;

NAME? ?? ?? ?? ?? ?? ?? ?? ?? ?RESULT

------------------------------ -------

新年快樂X? ?? ?? ?? ?? ?? ?? ? X

狿X? ?? ?? ?? ?? ?? ?? ?? ?? ? X

199? ?? ?? ?? ?? ?? ?? ?? ?? ? 199

春天會來的

-----------------------

原文:http://www.cnblogs.com/tippoint/p/3844738.html

總結(jié)

以上是生活随笔為你收集整理的oracle 函数 if 判断,oracle 判断中文函数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。