读书人

oracle函数施用

发布时间: 2013-04-12 18:33:12 作者: rapoo

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

读书人网 >oracle

热点推荐