Re: Strange Query error- please explain

From: L.Cornelese <lcornel_at_caiw.nl>
Date: 1996/08/23
Message-ID: <4vkvtc$1o9_at_newsserv.caiw.nl>#1/1


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
 

>--
>============================================================
> John M. Duska | Systems Analyst
> mailto:duska_at_srfs.pitt.edu | Information Resources
> http://www.pitt.edu/~pauj4m | University of Pittsburgh
>============================================================

If you didn't use trunc(sysdate) when inserting the date into the database it will have a "time-element", which you don't see in a query without using a formatmask like to_char(trandate,'DD-MM-YYYY HH24:MI:SS') When you use = 'some date' this will return no rows because '21-aug-96 00:00:00' is not the same as '21-aug-96 13:24:39'

Hope this helps

Lucy Cornelese



Lucy Cornelese email: lcornele_at_caiw.nl
HC Partners        phone: (31)174290731
Netherlands        fax  : (31)174290876
Received on Fri Aug 23 1996 - 00:00:00 CEST

Original text of this message