2008年4月10日 星期四

oracle DECODE

select cd,decode(
cd,
'LCD','11',
'MB','22',
'fff'
)
from cm_code
order by 1

相當於case when

select cd,
case when cd ='LCD' then '11'
when cd ='MB' then '22'
else 'fff'
end as CD2
from cm_code
order by 1