Decoding Function in Oracle

I have a condition like if (someparam! = Value1) someparam = 1 if (someparam! = Value2) someparam = 2 Default = 1

How to use the decoding function for this condition

+3
source share
3 answers
DECODE(SomeParam, Value1, DECODE(SomeParam, Value2, 1, 2), 1)

but better:

case when someparam != Value1 then 1
    whene someparam != Value2 then 2
    else 1
end
+7
source
 decode(someparam, value2, 1, 2)

All comparison with value1 seems redundant, since it will still be used by default.

0
source

DECODE (SomeParam, someParam!= value1, 1, someParam!= value2, 2, 1)

, someparam!= Value1 :

DECODE (SomeParam, someParam!= value2, 2, 1)

, : -)

0

Source: https://habr.com/ru/post/1760685/


All Articles