Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Question about date.
"gokrix" <gokrix_at_hotmail.com> wrote in message
news:50e71495.0410251025.217bde94_at_posting.google.com...
> SQL> select count(*) from VIEW1 where D_DATE = TO_DATE('20010319',
> 'YYYYMMDD');
>
> COUNT(*)
> ----------
> 1
>
> SQL> select count(*) from VIEW1 where D_DATE = TO_DATE('200103',
> 'YYYYMM');
>
> COUNT(*)
> ----------
> 0
>
> In the view VIEW1, there is one single record where the D_DATE is in
> the month March 2003.
>
> My question is why don't the two queries produce the same result?
>
> Thanks,
> --GS
This looks like homework, so I'll give a hint instead of an answer:
Think of these as algebraic equations. Then ask yourself if the two terms you are comparing are equal in content and meaning. The question you need to ask is this:
Is x = f(x)? So far, your answer for the first query is yes, but for the second query, no.
If the terms are not equal to begin with, they will never be equal. To solve this, make them equal. Received on Mon Oct 25 2004 - 13:46:44 CDT