Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle determines whether the mobile phone number is legal.

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Legal mobile phone numbers: all 11 digits and start with 13, 15, 18.

create or replace function isLegal

(phoneNumber in varchar2) return number

--Returns 0 for legal, returns 1 for illegal

as

begin

if length(phoneNumber) != 11 then return 1;

elsif replace(translate(phoneNumber, '0123456789', '0'), '0', '') IS not NULL THEN

--dbms_output.put_line(phoneNumber ||'is not a numeric sequence of [0-9]');

return 1;

elsif substr(phoneNumber,1,2) not in ('13','15','18') then

--dbms_output.put_line ('First two digits are illegal: '||substr(phoneNumber,1,2));

return 1;

else

--dbms_output.put_line ('legal number');

return 0;

end if;

exception when others then

--dbms_output.put_line ('Exception:');

return 1;

end isLegal;

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report