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: WildCards to match Date

Re: WildCards to match Date

From: <sybrandb_at_my-deja.com>
Date: Tue, 26 Sep 2000 10:24:54 GMT
Message-ID: <8qpth8$4mp$1@nnrp1.deja.com>

In article <39CFE804.B2508CB6_at_glue.umd.edu>,   liming <lmxu_at_glue.umd.edu> wrote:
> hi, I'm trying to match a date in my database with wildcards in the
> format of DD-MM-YYYY...for example, *-12-1998 should match with any
> dates of Dec in 1998.... .A gentleman called Steve pointed out some of
> my syntax error this afternoon......thanks Steve... I'm a newbie and
> just got started....thanks guys..
>
> I'm using Pro C...
>
> here is what I have in the program
>
> EXEC SQL declare curdob cursor for
> select dob,name from Contacts where
> to_date(dob,'DD-MM-YYYY') like to_date(:tdob,'DD-MM-YYYY') ORDER BY
> to_date(dob,'DD-MM-YYYY'),name;
> EXEC SQL open curdob;
> EXEC SQL fetch curdob into :cmatchdob,:cmatchname;
>
> But when I tested if the above operated correctly or not, using
> (sqlca.sqlcode<0) , it always tell me it's <0 which means
> that the above code was not excute correctly....what was wrong?????
> Thank you..
>
> Variable Descriptions:
> dob: date column name in the table (varchar)
> name: name column in the table. (varchar)
> :tdob: the string date I read from the input... (Varch
> :cmatchdob: a string to store date.....(Varchar)
>
> Thanks.
>
>

You can't use like on date columns.
The code above looks like a typical case of using trunc trunc(dob,'DD-MM-YYYY') = trunc(:dob,'DD-MM-YYYY')

Hth,

--
Sybrand Bakker, Oracle DBA

All standard disclaimers apply
------------------------------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Sep 26 2000 - 05:24:54 CDT

Original text of this message

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