Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem with dates in select
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
![]() |
![]() |