Oracle之:Function :func_float()

create or replace function func_float(i_value float)
return number
is
   v_index number := 0;
   v_str   varchar2(1000);
   v_result number(20,5);
   v_int varchar2(100);
   v_dec varchar2(100);
begin
   if i_value is null then
      return 0.0 ;
   end if;
   v_str :=   to_char(i_value);
   v_index := instr(v_str,'.');
   v_int := substr(v_str,0,v_index-1);
   v_dec := substr(v_str,v_index+1,5);
   v_str := v_int||'.'||v_dec;
   v_result := to_number(v_str);
   return v_result;
end;
原文地址:https://www.cnblogs.com/bilaisheng/p/10210985.html