aspose file tools*
The moose likes Oracle/OAS and the fly likes problem related to timestamp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "problem related to timestamp" Watch "problem related to timestamp" New topic
Author

problem related to timestamp

Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150
Hi,

I am using Oracle DB. I have one table which has one column with data type as timestamp. e.g data for this column is "26-FEB-08 11.58.38.712000000 AM".

Now I want to fetch all records created on the particular date. So I am writing query like "Select * from TABLE_XYZ where date like '26-FEB-08'", but its not fetching the records.

Solution to this problem is fetch data between two dates like "Select * from TABLE_XYZ where date between '26-FEB-08' and '27-FEB-08'".

Is there any functions that I can use, which will get me the records of the particular date, by which I can get results without using 'between'.
Problem with second approach, I need to take care of invalid dates.

Please Help me in this issue.

Thanks,


~ Anand,
SCJP 1.5, SCWCD 1.5
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10

Is there any functions that I can use, which will get me the records of the particular date, by which I can get results without using 'between'.
Yes, but it might be slower: select x, y from TABLE_XYZ where trunc(date) = '26-FEB-08'.

If you have an index on the date colum, then your between solution could be faster.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150
Thanks Jan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem related to timestamp