我在oracle库中有一张表,其中有一个字段为date类型的格式,我想根据时间来查询,请问在delphi中查询语句如何写?请高手指点!

解决方案 »

  1.   

    strSQL := 'select * from table1 where 日期 between ' + QuotedStr(DateToStr(dtp1.Date)) +
    ' and ' + QuotedStr(DateToStr(dtp2.Date));然后执行该sql即可
      

  2.   

    select * from 表 where 字段=todate('1-1-2004','dd-mm-yyyy');
    上面语句查找日期为2004年1月1日的记录。
      

  3.   

    select * from 表 where 字段=quotedstr(formatdatetime('1-1-2004','dd-mm-yyyy'));
      

  4.   

    select * from 表 where 字段=to_date('1-1-2004','dd-mm-yyyy');