22. 存储过程时间格式验证(13:30:00)

create or replace procedure sp_HRM_PunchTimeCheck(
o_Ret out int,
o_RetInfo out varchar2,
i_PunchTime varchar2
)
AS
v_PunchTime date;
Begin
o_Ret:=1;
o_RetInfo:='';
if length(i_PunchTime)!=8 then
o_Ret:=-1;
o_RetInfo:='时间长度必须为8!请按时间格式认真填写';
return;
else
begin
select to_date(i_PunchTime,'hh24:mi:ss') into v_PunchTime from dual;
exception when others then o_Ret:=-1;
end;
if o_Ret=-1 then
o_RetInfo:='填写的时间格式有误!请按时间格式认真填写';
return;
end if;
end if;

end;

原文地址:https://www.cnblogs.com/zkx4213/p/4994869.html