Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm trying to get records from an oracle database based on dates.

 

But when i send it the command :

Select * from TableName Where Timestamp > '12/01/2003 10:00:00'

 

it gives me an error

 

I have tried several formats for the date time string and i get errors on all of them.

 

The only thing i can get to work is using sysdate, and making calculations based on now() and the date given.

 

This works somewhat but it is not exact.

 

can anyone help with an example query string in vb.net to send it a date and time and have it return the records between that time.

 

Thanks.

Posted

try this command

Select * from TableName Where Timestamp > '01-DEC-2003: 10:00:00'

 

basically the format for date and time in oracle is DD-MON-YYYY: HH: MI: SS

 

and the HH is 24 hour clock

 

if you are just lookig at dates then it is 'DD-MON-YYYY' and if you don't specify a time then oracle assumes the time is 12:00:00 AM

Live as if you were to die tomorrow. Learn as if you were to live forever.
Gandhi
Posted

OR i belive you can do this

 

Select * from TableName Where Timestamp > TO_DATE('12/01/2003 10:00:00')

 

and oracle will translate it into Oracle type

Live as if you were to die tomorrow. Learn as if you were to live forever.
Gandhi

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...