Decode Function in Oracle
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.