Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Help required in pulling records for a particular date and time?

Posted on 2011-05-04
Medium Priority
Last Modified: 2012-05-11
Hi Experts,

Could you please help me in executing the following query:

Select * from RELAY_POLLER_LOG where lot_type_fk=1 and actual_date between '03-May-2011' and '04-May-2011'

I am using Oracle 10g as the database.

Question by:dileepav
LVL 74

Expert Comment

ID: 35690116
first, you are using implicit conversion to treat your strings as dates.  don't do that,  always (really, ALWAYS) use explicit conversions

try this...

Select * from RELAY_POLLER_LOG
where lot_type_fk=1
and actual_date  between to_date('03-May-2011','dd-Mon-yyyy') and to_date('04-May-2011','dd-Mon-yyyy')

if this doesn't work,  please post the errors or other results
LVL 78

Accepted Solution

slightwv (䄆 Netminder) earned 1000 total points
ID: 35690117
Assuming actual_date is an Oracle date, do explicit date conversions:

between to_date('03-May-2011','DD-Mon-YYYY') and to_date('04-May-2011','DD-Mon-YYYY')

LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 35690125
I can only confirm the date format stuff:

Author Closing Comment

ID: 35788349
Thx Experts
LVL 74

Expert Comment

ID: 35789412
if there are equivalent answers posted at the same time you should split among all of them

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question