oracle 自定义函数案例,Oracle Function 自定义函数建立实例

create or replace function getArea(speed IN Number) return varchar2

as

v_speed varchar2(100);

begin

select

case when (speed >0 and speed<1) or speed=1 then '0~1'

when speed >1 and speed <=2 then '1~2'

when speed >2 and speed <=3 then '2~3'

when speed >3 and speed <=4 then '3~4'

when speed >4 and speed <=5 then '4~5'

when speed >5 and speed <=6 then '5~6'

when speed >6 and speed <=7 then '6~7'

when speed >7 and speed <=8 then '7~8'

when speed >8 and speed <=9 then '8~9'

when speed >9 and speed <=10 then '9~10'

when speed >10 and speed <=11 then '10~11'

when speed >11 and speed <=12 then '11~12'

when speed >12 and speed <=13 then '12~13'

when speed >13 and speed <=14 then '13~14'

when speed >14 and speed <=15 then '14~15'

when speed >15 and speed <=16 then '15~16'

when speed >16 and speed <=17 then '16~17'

when speed >17 and speed <=18 then '17~18'

when speed >18 and speed <=19 then '18~19'

when speed >19 and speed <=20 then '19~20'

when speed >20 and speed <=21 then '20~21'

when speed >21 and speed <=22 then '21~22'

when speed >22 and speed <=23 then '22~23'

when speed >23 and speed <=24 then '23~24'

when speed >24 and speed <=25 then '24~25'

when speed >25 and speed <=26 then '25~26'

when speed >26 and speed <=27 then '26~27'

when speed >27 and speed <=28 then '27~28'

when speed >28 and speed <=29 then '28~29'

when speed >29 then '29~30'

else '0' end into v_speed from dual;

return v_speed;

end;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值