oracle儲存過程判斷手機號碼和固話

2021-07-10 17:45:48 字數 1694 閱讀 1180

create or replace procedure get_area_phone(i_phonenum   in varchar2,--傳入號碼

o_phoneflag  out varchar2,--返回手機號碼1,固話2,其他0

o_resultnum  out varchar2)

isiv_province varchar2(50);

iv_phonenum varchar2(50);

iv_count number;

iv_zipcode2 varchar2(50);

iv_zipcode varchar2(50);

v_strnum   varchar2(30);

v_400_phonenum varchar2(50);

begin

iv_count := 0;

o_phoneflag := '0';

--判斷手機號碼還是固話

if regexp_like(i_phonenum,'^1[3458]\d$') then --判斷手機號碼

v_strnum  := substr(i_phonenum,0,7);

o_phoneflag := '1';

select dpn.province_name into iv_province from dic_phone_num dpn where dpn.mobile_number = v_strnum;

elsif regexp_like(i_phonenum,'^(010|02\d|0[3-9]\d)?\d$') then --判斷固話

iv_zipcode2 := substr(i_phonenum,0,2);

o_phoneflag := '2';

if (iv_zipcode2 = '01' or iv_zipcode2 = '02' or iv_zipcode2 = '85') then

if regexp_like(substr(i_phonenum,0,3),'^(010|852|853|02\d)$') then

iv_zipcode := substr(i_phonenum,0,3);

end if;

else

if regexp_like(substr(i_phonenum,0,4),'^(0[3-9]\d)$') then

iv_zipcode := substr(i_phonenum,0,4);

end if;

end if;

if iv_zipcode is not null then

select dpn.province_name into iv_province from dic_phone_num dpn where dpn.area_code = iv_zipcode  and rownum=1;

end if;

end if;

if iv_province is not null then

select ***.phone_num into o_resultnum from dic_phone_province *** where ***.province=iv_province;

end if;

exception

--如果查不到對應的歸屬地返回 公用號碼

when no_data_found then

o_resultnum := '020';

end;

jq判斷手機號,郵箱正則

function checkmobile 定義手機號正規表示式 if reg.test smobile mobile change function 1 3 4 5 8 0 9 d 1代表以1開頭,現在中國的手機號沒有是其它開頭的,以後不一定啊 3 4 5 8 緊跟上面的1後面,可以是3或4或5或8...

手機號判斷

public class smsutil toast.maketext activity,手機號碼輸入有誤!toast.length short show return false 驗證手機格式 public static boolean ismobileno string mobilenums 1...

oracle判斷手機號碼是否合法

合法手機號碼 都是11位數,並且以13 15 18開頭的。create or replace function islegal phonenumber in varchar2 return number 返回0表示是合法,返回1表示是不合法 asbegin if length phonenumber...