日期:2014-05-17 浏览次数:20643 次
select name, (case when age > 24 then age else '不满足' end) as user_condition from your_table
------解决方案--------------------
oracle的话,可用#2的,但age要转一下类型,否则与后面的不配,以下的测试成功:
select name, (case when age > 24 then to_char(age) else '不满足' end) as user_condition
from test
------解决方案--------------------
用decode也可以:
select name, decode(sign(24-age),-1, to_char(age),'不满足') as user_condition
from test
/