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;