日期:2014-05-17  浏览次数:20856 次

oracle函数使用
传入一个表中字段   如果该字段大于5怎返回3  如果小于5则返回4   这个函数怎么写
大虾们  求指教   

------解决方案--------------------
select decode(sign(num-5),1,3,-1,4,default_num) as num from tablename

------解决方案--------------------
select case when f1>5 then 3 when f1<5 then 4 end from t