create or replace function s_isnumber(str varchar2)
return varchar2
is
s number;
begin
  select to_number(str) into s from dual;
  return 'yes';
  exception
    when others then
    return 'no';
    end;
   
   
create or replace function ischinese(str varchar2)
return varchar2
is
mychinese varchar2(5);
begin
  select decode(lengthb(str),2*length(str),'yes','no') into mychinese from dual;
  return mychinese;
  exception
    when others then
      return mychinese;
      end ischinese;   
     
 
create or replace function getnumbers(str varchar2)
return varchar2
is
currchar varchar2(10);
returnstr varchar2(10);
begin
  for i in 1..length(str) loop
  if str is not null then
    currchar:=substr(str,i,1);
    if ascii(currchar) between 48 and 57 then
      --concat(returnstr,currchar);
      returnstr:=returnstr||currchar;
      end if;
      end if;
          end loop;
      return returnstr;
      exception
        when others then
          return null;
          end getnumbers;
create or replace function getchinese(str varchar2)
return varchar2
is
currstr varchar2(10);
returnstr varchar2(50);
begin
  returnstr:=null;
  if str is not null then
    for i in 1..length(str) loop
    currstr:=substr(str,i,1);
    if ischinese(currstr)='yes' then
      returnstr:=returnstr||currstr;
      end if;
    end loop;
    end if;
    return returnstr;
    exception
      when others then
        return null;
        end;

select ischinese('1') from dual;
select getchinese('好像3S是成2*功了') from dual;
create or replace function to_dolar(str varchar2)
return varchar2
is
currNumber number(2);
currStr varchar2(10);
begin
  if str is not null then
    for i in 1..length(str) loop
      currStr:=substr(str,i,1);
      begin
        select to_number(currStr) into currNumber from dual;
        exception
          when others then
            return '敢忽悠我,我就什么都不返回';
        end;
      end loop;
    end if;
    return to_char('¥'||str);
    end;
   
   
    select to_dolar('1ss') from dual;
   
   
   
   
create or replace function mysplit(str in varchar2,splitestr varchar2:=',')
return varchar2
is
returnstr varchar2(10);
evestr varchar2(10);
begin
  returnstr:=null;
  if str is not null then
    for i in 1..length(str) loop
      evestr:=substr(str,i,1);
       returnstr:=concat(concat(returnstr,evestr),splitestr);
      end loop;  
      return rtrim(returnstr,',');
    else
      return '神马都不传,返回啥呀';
      end if;
  end;
 

select mysplit('SAD','%') from dual;
 
 
 
闲着没事就打打..就当打游戏了