SELECT case when substr('config_admin',0,5) = 'config' then 'A'
when substr('config_admin',0,2) = 'db' then 'A'
when substr('config_admin',0,4) = 'user' then 'A' else 'B' end
from dual
when substr('config_admin',0,2) = 'db' then 'A'
when substr('config_admin',0,4) = 'user' then 'A' else 'B' end
from dual
decode(substr('config_admin',0,2),'db','A',decode(substr('config_admin',0,4),'user','A','B'))) from dual