我想查询数据库中为DATA类型时间是2008-11-25 13:18:44的一条数据,我开始是这样写的:
from AO.fire.DBtables.HumanResources u where u.generationTime=‘2008-11-25 13:18:44’;
u.generationTime是对应的时间字段~~我该怎么来写这条语句?求条具体的语句!
from AO.fire.DBtables.HumanResources u where u.generationTime=‘2008-11-25 13:18:44’;
u.generationTime是对应的时间字段~~我该怎么来写这条语句?求条具体的语句!
where to_char(au.generationTime,'yyyy-mm-dd hh24:mi:ss')=‘2008-11-25 13:18:44’
转化一下就可以了。
这个应该也对:
select ... from ... where u.generationTime=to_date('2008-11-25 13:18:44','yyyy-mm-dd hh24:mi:ss');
where to_char(u.generationTime,'yyyy-mm-dd hh24:mi:ss') ='2008-11-25 13:18:44';
虽然to_char会写起来简单点(比如写等于一整天的,直接to_char(date,'yyyymmdd')='20081126'就行了)
但会索引失效,除非建基于to_char的索引