14.05 How to use decode( )
function
Syntax: select report-type,
decode(report-type,'BS','Balance Sheet','Profit and
Loss') as report-Desc from raak-ledger-master ; Result:
REPORT-TYPE REPORT-DESC
- - - - - - - - - - - - - - - - - - - - - - - - BS Balance Sheet
PL Profit and Loss
14.06 How to use case statement
The same function result can be achieved through case since it is simpler and understand and wordier commas are removed ,
Case ( column-name, when , then, when, then, else end )
Syntax: select report-type, case report-type when 'BS' then 'Balance Sheet' else'Profit and Loss' end as
report-Desc from raak-ledger-master ; REPORT-TYPE REPORT-DESC
- - - - - - - - - - - - - - - - - - - - - - - -