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

Home -> Community -> Usenet -> c.d.o.tools -> Re: date column in where clause -> suppressing index?

Re: date column in where clause -> suppressing index?

From: Brand Hunt <brand_hunt_at_my-deja.com>
Date: 2000/07/27
Message-ID: <8lq3ku$2e6$1@nnrp1.deja.com>#1/1

Jerra,

Rogue Wave's DBTools.h++ is very capable of generating the BETWEEN syntax that you require. Here is an example:

//...
RWDBDateTime dt1, dt2;
RWDBTable table = database.table("yourTable"); RWDBCritFormDefinition between("%0 BETWEEN %1 AND %2"); RWDBSelector selector = database.selector(); selector << table["column1"];
selector.where(between(table["column1"], dt1, dt2)); //...

Any standardized SQL criterion can be generated this way -- along with many other Oracle specific criterions.

Hope you find this useful,
Brand

In article <397EFBDE.BA0D26E6_at_aland.net>,   Jerra <jerra_at_aland.net> wrote:
> Yes that is possible to some extent, but we are using RW dbtools
 (C++) and I am
> not sure wheter they support that.
>
> Thanks for the reply!
>
> /Jerra
>
> Brian Peasland wrote:
>
> > Jerra,
> >
> > Why don't you use the BETWEEN operator? For example, to search a
 table
> > for today's date:
> >
> > SELECT * FROM table WHERE date_column BETWEEN TO_DATE('07/26/2000
> > 00:00','MM/DD/YYYY HH24:MI')
> > AND TO_DATE('07/26/2000
> > 23:59','MM/DD/YYYY HH24:MI');
> >
> > HTH,
> > Brian
> >
> > Jerra wrote:
> > >
> > > When using date and time how do I search for specific dates most
 efficently?
> > > Using where trunc(date,'DD') = to_date('26-07-2000','MM-DD-YYYY')
 the index
> > > for the date column can't be used.
> > > The time portion is important and can't be 00:00:00 and there is
 a lot of
> > > searches for posts for a specific day.
> > >
> > > TIA!
> > >
> > > /Jerra
> >
> > --
> > ========================================
> > Brian Peasland
> > Raytheons Systems at
> > USGS EROS Data Center
> > These opinions are my own and do not
> > necessarily reflect the opinions of my
> > company!
> > ========================================
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Jul 27 2000 - 00:00:00 CDT

Original text of this message

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