我想查询数据库中为DATA类型时间是2008-11-25 13:18:44的一条数据,我开始是这样写的:
from AO.fire.DBtables.HumanResources u where u.generationTime=‘2008-11-25 13:18:44’;
u.generationTime是对应的时间字段~~我该怎么来写这条语句?求条具体的语句!

解决方案 »

  1.   

    where to_char(u.generationTime,'yyyy-mm-dd hh24:mi:ss' ='2008-11-25 13:18:44';
      

  2.   

     select * from table 
     where  to_char(au.generationTime,'yyyy-mm-dd hh24:mi:ss')=‘2008-11-25 13:18:44’
    转化一下就可以了。
      

  3.   

    1楼2楼的应该行
    这个应该也对:
    select ...  from ...  where u.generationTime=to_date('2008-11-25 13:18:44','yyyy-mm-dd hh24:mi:ss');
     
      

  4.   


    where to_char(u.generationTime,'yyyy-mm-dd hh24:mi:ss') ='2008-11-25 13:18:44';
      

  5.   

    SELECT * FROM AO.fire.DBtables.HumanResources u WHERE TO_CHAR(u.generationTime,'YYYY-MM-DD HH24:MI:SS')='2008-11-25 13:18:44'
      

  6.   

    一般对于时间上过滤,建议用to_date
    虽然to_char会写起来简单点(比如写等于一整天的,直接to_char(date,'yyyymmdd')='20081126'就行了)
    但会索引失效,除非建基于to_char的索引