Oracle之:Function :func_float()

来源:互联网 发布:js金额格式化 编辑:程序博客网 时间:2024/06/06 07:05
create or replace function func_float(i_value float)return numberis   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;
原创粉丝点击