(case
        when b."promotionid1"='' then ''
        when b."promotionid2"='' then ''
        when b."promotionid3"='' then ''
        when b."promotionid4"='' then ''
        when b."promotionid5"='' then ''
        else ???
        end
)
如果值不为空,怎么分别取到promotionid1......promotionid5的值???

解决方案 »

  1.   

    貌似语句写错了!case when里好像只允许判断一个字段,Oracle会把错误的字段给忽略!等于  
      when b."promotionid2"='' then ''
      when b."promotionid3"='' then ''
      when b."promotionid4"='' then ''
      when b."promotionid5"='' then ''
    这些字段都不会判断了是吗?
      

  2.   

    我是问else后面怎么写!但Oracle会把错误的字段排除吧!就是我上面说的一样!
      

  3.   

    case when b.promitionid1 = '' then '' else b.promitionid1 end;
    对 5 个都加case when 判断,或者直接使用 nvl(b.promitionid1,'') 这样也可以
      

  4.   

    case when里是不是只允许判断一个字段?