如何在PLSQL中搜索日期和时间 [英] How to search in PLSQL for date and time
本文介绍了如何在PLSQL中搜索日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
所以我有一张桌子,我想在特定的日期和时间搜索特定的数据。
我有一个名为DT的字段,包括日期和时间。我可以返回特定日期的研究,但我也有问题返回特定的时间。
所以我有:
Hi
So i have a table which i want to search for specific data on a specific date and time.
I have a field called DT which consist on date and time. I can be able to return research for specific date but i m having issue to return specific time as well.
so for example i have:
select t.*, t.rowid from customers t where trunc(created_date) = to_date ('07/08/2015, 'mm-dd-yyyy')
现在保存数据的字段是这样的:
04/08/2015 11:34:24 AM
所以我的问题是如何修改我的SQL以恢复特定时间的结果?
提前致谢!
Now the field that holds the data is like this:
04/08/2015 11:34:24 AM
So my question is how do i modify my SQL to bring back results for that specific time??
Thanks in advance!
推荐答案
Use time format HH:MI:SS in your to_date function, Like this
where created_date > to_date('07/08/2014 15:14:30' , 'DD/MM/YYYY HH24:MI:SS')
这篇关于如何在PLSQL中搜索日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文