aspose file tools
The moose likes JDBC and the fly likes Querying Oracle with Java for To_Date Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Querying Oracle with Java for To_Date" Watch "Querying Oracle with Java for To_Date" New topic
Author

Querying Oracle with Java for To_Date

Cynthia Blue
Greenhorn

Joined: Nov 14, 2006
Posts: 3
I am attempting to query an oracle DB with Java. I'm brand new to Java so just learning, learning about Oracle too.

I would like the results to be all entries that are before and including 7/6/2006, regardless of the time. But the oracle field is a date & time field.

This is the baseline query I am attempting to modify. The results of this query give me 7/5/2006 and before. It does not give me any results in 7/6/2006. I can, of course, change the 00:00:00 to 23:59:59... however, that part of the query is coming from a DataObject which I don't know how to modify, nor do I really want to as it's used throughout our rather extensive application.




How would I modify the query to get the results I need?

This is all user driven. The user enters a date in the parameter field to run a report. The user wants to be able to put 7/6/2006 in the parameter field and get all records before and equal to 7/6/2006. Time is not a parameter. Currently they are not getting the 7/6/2006 records, and I believe it's because of the time stamp being in there.
Thanks in advance!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24040
    
  13

Howdy Cynthia,

Welcome to JavaRanch!

We've got a whole forum named "JDBC" up there, where JDBC and SQL questions feel at home on the range. I'm a fixin' to move this thread over yonder fer ya. Mosey on over and see what the experts have to say...


[Jess in Action][AskingGoodQuestions]
Cynthia Blue
Greenhorn

Joined: Nov 14, 2006
Posts: 3
Oops sorry and thanks for moving this.
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
Try this:


Truncate function will remove the time component from the field.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Querying Oracle with Java for To_Date
 
Similar Threads
Date comparision in SQL from timestamp
Converting String to Date???
Querying Oracle with Java for To_Date
Unable to fetch records by using 'where' clause for a date type field in sql
Resultset based on current Date and Time