获取case when的值 在线等。。
本帖最后由 New_sara 于 2012-11-20 10:50:53 编辑
select
case when &value >=1 then 1 else 0 end as a,
case when &value >=2 then a + 2 else 0 end as b,
case when &value >=3 then b + 3 else 0 end as c
from dual
select
case when &value >=1 then 1 else 0 end as a,
case when &value >=2 then case when &value >=1 then 1 else 0 end + 2 else 0 end as b,
case when &value >=3 then case when &value >=2 then case when &value >=1 then 1 else 0 end + 2 else 0 end + 3 else 0 end as c
from dual
select
case when &value <=1 then 1 else 0 end as a,
case when &value <=2 AND &VALUE>1 then 3 WHEN &value <=1 THEN 2 else 0 end as b,
case when &value <=3 AND &VALUE>2 then 6 when &VALUE>1 then 5 WHEN &value <=1 THEN 4 ELSE 0 end as c
from dual