Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> RESOLVED: Re: Decode() function fails in 8.1.5/Linux
It turns out that I was querying a VARCHAR2 column, and these seem to
need an RTRIM before comparing with a constant. It is also true that
in writing this up I used " instead of ', but I hadn't made that error
in the actual SQL.
In any event, adding RTRIM to the code made it work....
Kevin O'Gorman wrote:
>
> I'm running 8.1.5 (8i) Enterprise Edition on RedHat Linux, and trying
> to execute some of the queries from the TPC-D benchmark suite (for
> research).
>
> Infortunately, all of the queries with the decode() function in the
> select list fail. They all take the default value no matter what the
> other inputs are, it seems.
>
> The pattern is
> select
> decode(gb_attribute, "foo", expr, 0)
> from
> <some tables>
> where
> <some conditions>
> group by
> gb_attribute,
> <and possibly some others>
>
> Now it does seem that this should work: the group-by attribute
> is available, and constant per output row. However, the result
> is always zero.
>
> Any clues out there? Any confirmation that this happens elsewhere?
>
> --
> Kevin O'Gorman (805) 650-6274 kogorman_at_pacbell.net
> At school: kogorman_at_cs.ucsb.edu
> Permanent e-mail forwarder: Kevin.O'Gorman.64_at_Alum.Dartmouth.org
--
Kevin O'Gorman (805) 650-6274 kogorman_at_pacbell.net
At school: kogorman_at_cs.ucsb.edu
Permanent e-mail forwarder: Kevin.O'Gorman.64_at_Alum.Dartmouth.org
Received on Tue Dec 14 1999 - 14:29:23 CST
![]() |
![]() |