一:if translate(str,'\0123456789','\') is null then --为空则全是数字 --your code end if;
二: select ascii(9) from dual;48到57为数字。
三:大小写还是等于自己的,那就是数字upper('1')=1
--判断是否为日期格式:
create or replace function F_CheckDate(param in varchar2) return number is
colType date;
begin
colType := to_date(param, 'yyyy-mm-dd hh24:mi:ss');
DBMS_OUTPUT.put_line(colType);
return 1;
exception
when others then
return 0;
end F_CheckDate;
本文介绍了使用SQL查询判断字符串是否全为数字及验证日期格式的方法。通过ASCII码比较和TO_DATE函数,实现数据有效性检查。
960

被折叠的 条评论
为什么被折叠?



