2006年03月8日

Oracle's CASE Expression


來源:http://www.dbasupport.com/oracle/ora9i/caseExpression01.shtml

多看別人的code也是讓自已進步的一個方法~

select (case when qty_less6months < 0 and qty_6to12months < 0 then
(case when season_code in ('0', '1', '2', '3', '4') then 'value is negative'
else 'No stock'
end)
when qty_1to2years < 0 and qty_2to3years < 0 then
(case when season_code in ('A', 'B', 'C', 'D', 'E') then 'value is negative'
else 'No stock'
end)
else 'Stock Available'
end) stock_check
from jnc_lots_ageing_mexx_asof
where rownum < 20
and qty_less6months < 0 and qty_6to12months < 0
 

 

Posted by my_work at 樂多Roodo! │12:28 │回應(0)引用(0)DB
樂多分類:網路/3C 共同主題:Oracle 工具:編輯本文
Ads by Roodo! 

引用URL

http://cgi.blog.roodo.com/trackback/1222916