------解决方案-------------------- create or replace function f1(p1 varchar2) return varchar2 is a char(1); b varchar2(20); c varchar2(20); d varchar2(20); begin a :=substr(p1,0,1); if (a = '-' or a = '+' ) then b :=substr(p1,2,instr(p1,'.',2,1)-2); c := lpad(b,15,'0'); d := rpad(substr(p1,instr(p1,'.',1,1)+1),3,'0'); else a := '+'; b :=substr(p1,0,instr(p1,'.',1,1)-1); c := lpad(b,15,'0'); d := rpad(substr(p1,instr(p1,'.',1,1)+1),3,'0'); end if; return a || c || '.' || d; end; /
------解决方案--------------------
SQL code
--直接to_char是可以的
select to_char(12345.5,'S000000000000000.000') from dual;
------解决方案--------------------