手机号或者电话号验证自定义函数

create or replace function mobile_check

    (mobile in string) return varchar2 is

declare

 o_result varchar2(30);

begin

   if trim(mobile) regexp '^[1][3456789][0-9]{9}$' or

    trim(mobile) regexp '^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,6})?$' then 

    o_result := trim(mobile);

           else

    o_result := '';

   end if;

    return o_result;

end;

 

posted @ 2021-04-15 09:46  Windsong的博客  阅读(198)  评论(0)    收藏  举报