DECODE(x,y(i),...,z)
DECODE(x,y(i),...,z)
is a special
function which decodes expressions in
accordance with their values.
|
|
Expression ( |
|
|
Combination of the comparison value |
|
|
Optional default value (LOB value is permissible) |
|
|
Comparison value that is to be replaced by |
|
|
Value that is to replace the value |
The data types of x
and u(i)
must
be comparable. The data types of v(i)
and z
must
be comparable. The data types of u(i)
and v(i)
do
not have to be comparable.
DECODE
compares the values of x
with
the values u(i)
consecutively. If values match,
the result of DECODE
is the value v(i)
in
the combination y(i)=u(i),v(i)
.
If x
and u(i)
are NULL
values,
then a match exists. The comparison of the special NULL
value
with any other value never results in a match. If no match is found, DECODE
returns
the result of z
. If z
is
not specified, the result of DECODE
is the NULL
value.
SQL Tutorial, Converting Values