RT.
-- created by husthxd
create or replace function isGmsfhmWrong(vi_gmsfhm in char)
return varchar2
is
vc_gmsfhm varchar2(20);
vn_gmsfhm number;
begin
select replace(upper(vi_gmsfhm),'X','')
into vc_gmsfhm
from dual;
begin
select to_number(vc_gmsfhm)
into vn_gmsfhm
from dual;
exception when others then
return 'NOT VALID';
end;
return 'VALID';
dbms_output.put_line(vc_gmsfhm);
end;
/
SQL> select isGmsfhmWrong('1352352324') from dual;
ISGMSFHMWRONG('1352352324')
--------------------------------------------------------------------------------
VALID
SQL> select isGmsfhmWrong('135w2352324') from dual;
ISGMSFHMWRONG('135W2352324')
--------------------------------------------------------------------------------
NOT VALID
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/6906/viewspace-21734/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/6906/viewspace-21734/