Decode Function in Oracle 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.
Note that for some cases, an if statement can be turned into a case expression which is somewhat similar to the ? operator in C and Java, but more generic. Your pseudo-code:

if(trans_type = 'AR','AD','AF','AG') then
trans_type:='A';
elsif trans_type = 'BA','BS','BD','BG' then
trans_type:='B';
end if;


becomes:

case
  when trans_type in ('AR','AD','AF','AG') then 'A'
  when trans_type in ('BA','BS','BD','BG') then 'B'
end case


as a case expression.