阅读背景:

Oracle 获取字符串中所有中文汉字(不含标点符号)

来源:互联网 
CREATE OR REPLACE Function F_GetCHT(Str Varchar2) Return Varchar2 Is
  I       Int;
  Sub_Str Varchar2(500);
  Str2    Varchar2(500);
  Str1    Varchar2(500);
  Str3    Varchar2(500);
  Len     Int;
Begin
  Str2 := Str;
  Select Length(Str2) Into I From Dual;
  While I > 0 Loop
    select substr(str2, 1, 1) into Sub_Str from dual;
    Select asciistr(Sub_Str) Into str3 From Dual;
    Select substr(str3, 1, 3) Into str3 From Dual;
    select lengthb(sub_str) into len from dual;
    If str3 != '\FF' and len = 3 Then
      str1 := str1 || Sub_Str;
    End If;
    Select Substr(Str2, 2, Length(Str2)) Into Str2 From Dual;
    Select Length(Str2) Into I From Dual;
  End Loop;
  if Str1 is null then
    Return substr(Str, 10);
  else
    Return Str1;
  end if;
End;CREATE OR REPLACE Function F_GetCHT(Str Varchar



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: