Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: query on date

Re: query on date

From: Christoph Wagner <christoph.wagner_at_gamed.com>
Date: Fri, 31 Mar 2000 14:14:30 +0100
Message-ID: <8c24q3$p8c$1@readme.inode.at>


This one is OK but if there is an index on the column date_of_death it would not be used, because index is not used if you perform functions on such columns.

This one would be OK for an index scan.

SELECT *
    FROM patient
 WHERE date_of_death BETWEEN to_date('01-JAN-'||param,'DD-MON-YY')

                                                  AND
to_date('31-DEC-'||param,'DD-MON-YY');

Also mind the 4-Digit YEAR ('YYYY');

greetings Christoph

simon cunningham <cs694_at_gre.ac.uk> schrieb in im Newsbeitrag: 38E48CA0.990C8BAF_at_gre.ac.uk...
> Hi
>
> I have a table with the date_of_death as a column dd-mm-yy.
> Now I wan to run a select statement from this column, where the clause
> is on the year,
>
> So
> select *
> from patient
> where (trunc ('date_of_death', 'YY') = '94'
> file://where YY is year
> Is this the corect way to run this query
>
> Thanks everyone
>
Received on Fri Mar 31 2000 - 07:14:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US