Home Oracle Commands Oracle Syntax
decode

Return different values based on the content of a column/expression.

   decode(expression, search1, return1,
                      [search2, return2]...
                      [default] )

e.g.
   SELECT decode(sex, 'M', 'Male',
                      'F', 'Female', 'Unknown')
   FROM   employees;

You can convert a character or expression that contains a number into an actual number value.

The 'format' must be a valid Number format.

nls_lang allows international formats to be applied e.g. currency symbols and numeric chars.

See Also

CASE function



Back to the Top

Simon Sheppard
SS64.com