Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Problem with Decode fuction
"Tom Miskiewicz" <miskiewicz2_at_yahoo.com> wrote in message
news:unHdb.7$p1.19843_at_news.ecrc.de...
> Are there alternatives to the above quesry with respect to performace?
> Or is the comparsion to DUAL the non-plus-ultra of this kind of querys?
>
> Thanks
> Tom
>
>
Usually a query can be written in many different ways. Same is the case with
your query.
Your version however did not give correct results (as per your statement).
For example if you had done the following:
SELECT DECODE(COUNT(1), 0, NULL,1) FROM my_table
WHERE field1 = 'STRING1' AND
component_type = 'STRING2' AND
component = 'STRING3' AND
plant != 'STRING4';
You actually might have gotten the right results. However, it would have
been inefficient.
To understand why the exists query works better, you need to grab a book on
performance tuning.
I'd suggest the new Tom Kyte's book.
Anurag Received on Sun Sep 28 2003 - 15:41:25 CDT
![]() |
![]() |