所以我有一个oracle sql表,其信息如下所示:
USERID DATETIME_STAMP DESCR254
=================================================================
ZX08067 6/22/2012 4:26:03.589868 PM Tools and Calculators
-------
-------
如何通过获取确切的DATETIME_STAMP来检索显示的行? 我尝试了以下查询,但它没有返回任何行。 DATETIME_STAMP部分有什么问题?
select * from sysadm.PS_IS_STATS_URLS
where USERID = 'ZX08067'
AND DESCR254 = 'Tools and Calculators'
and DATETIME_STAMP = (to_timestamp('22/06/2012 04:26.03.589868', 'dd/mm/yyyy hh24:mi.ss.ff'))
答案 0 :(得分:1)
您的数据库显示12小时格式的时间,后缀为“PM”。您的查询是使用24小时制,因此它会在12小时后关闭。查询应为:
select * from sysadm.PS_IS_STATS_URLS
where USERID = 'ZX08067'
AND DESCR254 = 'Tools and Calculators'
and DATETIME_STAMP = (to_timestamp('22/06/2012 16:26.03.589868', 'dd/mm/yyyy hh24:mi.ss.ff'))