Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem with Decode fuction

Re: Problem with Decode fuction

From: Alex Filonov <afilonov_at_yahoo.com>
Date: 2 Oct 2003 09:34:38 -0700
Message-ID: <336da121.0310020834.7d6e32dc@posting.google.com>


"Tom Miskiewicz" <miskiewicz2_at_yahoo.com> wrote in message news:<ShEdb.1$p1.15090_at_news.ecrc.de>...
> Hello!
>
> SELECT DECODE(COUNT(1), 1, 0, NULL) FROM my_table
> WHERE field1 = 'STRING1' AND
> component_type = 'STRING2' AND
> component = 'STRING3' AND
> plant != 'STRING4';
>
> This one works fine, if there is only one record in the table. If there are
> more than one I get a false result. Can someone tell me please how this
> should look like independent on the number of records in the table?
>
>
> Thanks
> Tom

Tom,

you've got a lot of crappy response, which is OK when you post a crappy question. You select works exactly as you wrote it. If you want to return 1 when your count is greater than 0, you need different decode:

SELECT DECODE(COUNT(1), 0, NULL, 1) FROM my_table.... ..... Received on Thu Oct 02 2003 - 11:34:38 CDT

Original text of this message

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