1. 程式人生 > >oracle where 條件中用case

oracle where 條件中用case

               
select   substr(xoq.item,2,5) modelfrom xwp_out_quantity xoqwhere xoq.vendor='&s_vendor'and (casewhen xoq.vendor='220010'then substr(xoq.item,2,1) elsenullend)=9or  (casewhen xoq.vendor='220020'then substr(xoq.item,2,1) elsenullend)=8or  (casewhen xoq.vendor='220030'then substr(xoq.item,2,1) elsenullend)
=7