zoukankan      html  css  js  c++  java
  • 27. 时间“13:00:00”格式验证

    create or replace procedure sp_HRM_PunchTimeCheck(
      o_Ret out int,
      o_RetInfo out varchar2,
      i_PunchTime varchar2
    )
    AS
    v_flag varchar2(25);--第一个冒号
    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 substr(i_PunchTime,3,1) into v_flag from dual;
        if v_flag!=':' then
        o_Ret:=-1;
        else
          select substr(i_PunchTime,6,1) into v_flag from dual;
          if v_flag!=':' then
            o_Ret:=-1;
          else
            begin
              select to_date(i_PunchTime,'hh24:mi:ss') into v_PunchTime from dual;
              exception when others then o_Ret:=-1;
            end;
          end if;
        end if;
      end;
      if o_Ret=-1 then
        o_RetInfo:='填写的时间格式有误!请按时间格式认真填写';
        return;
      end if;
      end if;

    end;

    正则表达式

     [0-9]{2}:[0-9]{2}:[0-9]{2} 
     [0-9][0-9]:[0-9][0-9]:[0-9][0-9] 
  • 相关阅读:
    print 参数
    note
    action标签的属性说明
    Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
    润乾报表
    javax.naming.NameNotFoundException: Name ZKING is not bound in this Context 的问题
    Myeclipse2013安装svn插件
    Myeclipse2013的优化设置
    Myeclipse解析.classpath文件
    Struts
  • 原文地址:https://www.cnblogs.com/zkx4213/p/5085953.html
Copyright © 2011-2022 走看看