Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: decode or not decode?
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 CHARPENAYReceived on Wed Sep 12 2001 - 06:09:01 CDT