asp: isdate()函数
如: isdate(cstr(yourstr))

解决方案 »

  1.   

    好象没有现成的函数,你可以在存储过程里判断呀。len(a)要个判断,substring( a, 5,2) >12 ot not.
      

  2.   

    oracle里有这样的函数吗?
    要不,得自己写一个合法日期判断吧。
      

  3.   

    SQL> select to_date('200314','yyyymm') from dual;
    select to_date('200314','yyyymm') from dual
                   *
    ERROR 位于第 1 行:
    ORA-01843: 无效的月份在plsql中利用异常处理机制可以实现的。
      

  4.   

    用PL/SQL异常出来来判断:
     begin 
      select TO_DATE( my_rq, 'yyyymmdd' ) INTO rq from dual;
     EXCEPTION 
      when others then 
       raise_application_error( -20218, '日期格式不对my_rq='||my_rq||' ,正确格式    YYYYMMDD' );
     END;
      

  5.   

    可以用to_date通过异常来判断,
    也可以在应用程序中做限制。
      

  6.   

    create function is_date(p_date in varchar2)
    return number
    as
    a date;
    begin
    a:=to_date(p_date,'yyyymm');
    return 1;
    exception
    when others then
    return 0;
    end;
    /
    select * from table_name where is_date(col_date)=1;
      

  7.   

    result_date date;
    begin
    select result_date = to_date(input_date, 'yyyymm' );exception
    when others then
    //format error
    end;
      

  8.   

    就用 To_date() 就可以啦~to_date('200211','yyyymm') 然后捕捉异常.