I have a table named as transaction,in that table trans_type column is there.I want to check the trans_type like bellow
if(trans_type = 'AR','AD','AF','AG') then
trans_type:='A';
elsif trans_type = 'BA','BS','BD','BG' then
trans_type:='B';
end if;
How to write this one by using decode function? Kindly tell me answer.
Best Answer
Note that for some cases, an
if
statement can be turned into acase
expression which is somewhat similar to the?
operator in C and Java, but more generic. Your pseudo-code:becomes:
as a
case
expression.