This is one of the more popular functions available in PL-SQL.
Syntax:
DECODE ( <subject>, <testval>, <return-this-if-true>, <otherwise-return-this> )
Example:
select DECODE ( bonus, null, 100, bonus + 100 )
from employee ;
In this example, the column bonus is tested, if it is null, then 0 is returned, otherwise the bonus + 100 is returned.
|
|