dbTalk Databases Forums  

I must be missing the obvious

comp.databases.oracle comp.databases.oracle


Discuss I must be missing the obvious in the comp.databases.oracle forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Wit Serdakovskij
 
Posts: n/a

Default Re: I must be missing the obvious - 07-02-2004 , 09:13 AM






[...]

Quote:
I get today 30-JUN-04. If there are 10 records in X including 3 from
today, why does

'select count(1) from X where datestamp < '01-JUL-04' return 10 but

'select count(1) from X where datestamp <= '30-JUN-04' returns 7?

It's simple. Really your first query gets all the JUNE records. The
second query gets record with datestamp less than '01-JUN-04 00:00:00'
and records with datestamp equal to '01-JUN-2004 00:00:00' (not with
01-JUN-04 with some time portion). Again, '01-JUN-04 14:14:14' is
greater than '01-JUN-04'.

[...]

Be careful with DD-MON-YY. Use DD-MON-RR (or DD-MON-YYYY) instead.
[...]

Quote:
Don't use an implicit conversion of a string to a date! Use to_date()
instead. You have bug in your code just waiting to bite you.
Agreed. That's just a notation from replied message...


--
wbr,
Wit.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.