日期:2014-05-16 浏览次数:20421 次
--函数1 
--作用  判断是否为数字
create or replace function isNumber(p_in varchar2) return varchar2 as
  i number;
begin
 --是否有E字母,因为程序会将字母 E 解析为数字 如果有,直接返回FALSE
  if(instr(p_in,'E') = 0) then
      i := to_number(p_in);
      return 'TRUE';
  else 
       return 'FALSE';
  end if;
exception
  when others then
    return 'FALSE';
end;--函数2
--作用 判断第几位为字符
create or replace function findCharToPostion(p_in varchar2, p_positon number)
 return  varchar2 as
  c char(1);
  i number;
begin
  select substr(p_in,p_positon,1) into c from dual;
  i := to_number(c);
  return 'FALSE';
  exception 
     when others then
      return 'TRUE';
end findCharToPostion;--找出[Column]第三位为字符的所有数据 select * from TABLE where findCharToPostion(Column,3) = 'TRUE'; --找出[Column]第四位为字符的所有数据 select * from TABLE where findCharToPostion(Column,4) = 'TRUE';