Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Querying Oracle with Java for To_Date

 
Cynthia Blue
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Cynthia Blue
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops sorry and thanks for moving this.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:


Truncate function will remove the time component from the field.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic