Re: Strange Query error- please explain

From: Alexander Moan <moan_at_sn.no>
Date: 1996/09/01
Message-ID: <50bl5g$a4q_at_hasle.sn.no>#1/1


Hi !

Remember that a date also contains time even if it just displays as DAY-MONTH-YEAT or whatever.

A comparison with a date like trandate = '21-aug-96' really means trandate = '21-aug-96 at some time of day'

Try using TRUNC(trandate) = some date string.

james.cen_at_lex.mts.dec.com (James Cen) wrote:

>Another possibility is that "aug" in '21-aug-96' is in lower case. The
>default date format could be in upper case, i.e., '21-AUG-96'.
 

>It is a safe practice to use "WHERE trandate =
>TO_DATE('21-AUG-96','DD-MON-YY')" in your query. This way, your code is
>independent of the default date format in your database.
 

>james.cen_at_lex.mts.dec.com
 

>In article <4vkvtc$1o9_at_newsserv.caiw.nl>, lcornel_at_caiw.nl (L.Cornelese) wrote:
 

>> John Duska <duska_at_srfs.pitt.edu> wrote:
>>
>> >When I query a row in a database using "where trandate = '21-aug-96'" I
>> >get 'no rows' returned. But if I do the same query using "where trandate
>> >like '21-aug-96'", I get 1 row returned! The one row is the correct
>> >answer. What is causing this ananomly? This is Oracle 6.0, btw.
>> >thanks,
>> >John
>>
Received on Sun Sep 01 1996 - 00:00:00 CEST

Original text of this message