select exgno,producttype,
    case when exgno like '01%' and  producttype='1' then 'A'
         when exgno like '01%' and  producttype='2' then 'B'
         when exgno not like '01%' and  producttype='1' then 'C'
         when exgno not like '01%' and  producttype='2' then 'D'
    end as XM
from BOM

解决方案 »

  1.   

    select exgno,producttype,
        case when exgno like '01%' then decode(producttype,'1','A', 'B')
        else decode(producttype,'1','C', 'D')
        end as XM
    from BOM
      

  2.   

    yaozw_mountain(山林) ( ) 比我答的好
      

  3.   

    学习
    就是decode函数和C里面的?:功能差不多的是吧?
      

  4.   

    就是类似if  else 的功能
      

  5.   

    case when then else end 
    好像在9i以后才能用
      

  6.   

    case when then else end 8i 也有.我就是用8.1.6