Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL to_date problem
Both are correct.
But in first case you try to find rows where ba_erkezes field contains '01
SEPTEMBER 1998 00:00:00' because
'YYYY/MM' date format defaults dd = 1, hh:mm:ss = 00:00:00.
In second case you try to find rows where ba_erkezes field contains any date in
range from
'01 SEPTEMBER 1998 00:00:00' to '30 SEPTEMBER 1998 23:59:59'.
So you have two queries with two different purposes.
Best regards
Dennis.
MGperY wrote:
> Hi there !
>
> I have 2 querys:
> select distinct 0 from boltok, bma
> where ba_bjkod=bj_kod
> and ba_erkezes=to_date('1998/09','YYYY/MM');
> -------------------------------------------------
> select distinct 0 from boltok, bma
> where ba_bjkod=bj_kod
> and to_char(ba_erkezes,'YYYY/MM')='1998/09';
>
> the 1st give me no rows, the 2nd give me 1 row, wich is the correct answer.
> I think these two must have the same result, but somethings is be wrong with
> the format mask.
> Can you help me ?
>
> (I don't want to use the 2nd, because it does not use my index, and the bma
> has 80000 rows...)
>
> thanx
>
> M.
Received on Thu Oct 22 1998 - 13:24:06 CDT