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: Problem with dates in select

Re: Problem with dates in select

From: isa <isapmon_at_terra.es>
Date: Wed, 23 Oct 2002 17:09:14 GMT
Message-ID: <_IAt9.1078938$sI1.8608208@telenews.teleline.es>


Hi:

I think columname is a date field, true?

In that case:

    where to_date(to_char(columnname,'DD.MM.YYYY'),'DD.MM.YYYY') - TO_DATE('UserValue','DD.MM.YYYY')

This gives integer values.

Regards,

                    Isa


"Volker Schmid" <Info_NoSpam_at_Inspirant.de> escribió en el mensaje news:ap68st$tcf$1_at_news.online.de...
> Hi,
>
> The User inputs: ColumnName, Operator (=,<,>,!=) and a Value.
> In SQL-Server I used this to create an SELECT-statement with the user
input:
>
> If the value is a date and the column is also date i created the
following:
>
> SELECT * FROM Objects WHERE DateDiff(day, Columnname, 'UserValue') = 0
>
> The '=0' changes with the choosen operator.
>
> How can I do this in Oracle?
>
> SELECT * FROM Objects WHERE TRUNC(Columnname - TO_DATE('UserValue',
> 'DD.MM.YYYY')) =0;
>
> works great. But if I use < or > it doesn't do good because a truncated
> result of -0.35 or 0.67 is always 0! So it's not working in every cases.
>
> Please give me tips or a good solution.
>
> The same problem occurs in future if I try to use between, or?
>
> Thanks,
>
> Volker
>
Received on Wed Oct 23 2002 - 12:09:14 CDT

Original text of this message

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