SQL> select * from baltyp;
BALTYPCD
----------
note
odx
seb
abc
SQL> select baltypcd,decode(baltypcd,'note',0,'odx',1,'seb',2,3) resultid from b
altyp order by resultid;
BALTYPCD RESULTID
---------- ----------
note 0
odx 1
seb 2
abc 3