Google adsense

Search

Tuesday, September 7, 2010

Oracle: Case when

case when x = y then a else b end

case when x < y then a when x = y then b else c end

case XYZ when 'foo' then 'moo' else 'bar' end


select a,
case
when b = '*' then 'star'
when b = '+' then 'plus'
when b = '-' then 'minus'
else '????'
end
from table_test_case_when;

Thanks,
Info source: http://www.adp-gmbh.ch/ora/sql/case_when.html

No comments:

Post a Comment