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: decode or not decode?

Re: decode or not decode?

From: Pierre Charpenay <pierre.charpenay_at_unilog.fr>
Date: Wed, 12 Sep 2001 13:09:01 +0200
Message-ID: <3B9F424D.FEC49550@unilog.fr>


gil guerillot a écrit :
>
> i have 3 fields A,B,C for each code but only one must be not null.
>
> select code,a,b,c
> from table
>
> i want to find the rows where 0,2 or 3 fields are not null
>
> i want to define a new field 'search_error' with decode clause but i don't
> know how!
>

You can use "decode(A,null,0,1)+decode(B,null,0,1)+decode(C,null,0,1)". It will give you the number of not null columns.

> thanks!!!

-- 
 Pierre CHARPENAY
Received on Wed Sep 12 2001 - 06:09:01 CDT

Original text of this message

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