'yyyy-mm-dd'????
你能確信資料表中的日期格式也是這樣嗎

解决方案 »

  1.   

    日期比较可以直接使用< > >= <= =,我经常这样用,从来没出过错。
    如果mydate是日期格式,则根本不需要转换。将字符串转换成日期格式应该用to_date()
      

  2.   

    sql="select* from table where to_date(mydate,'yyyy-mm-dd')>=to_date("&cstr(startdate),'yyyy-mm-dd) and  to_date(mydate,'yyyy-mm-dd')<=to_date(""&cstr(enddate)&",'yyyy-mm-dd) ')"