오라클 소숫점 자리수 반환 함수

    CREATE OR REPLACE FUNCTION isDECIMALPOINT (p_num IN VARCHAR2) RETURN NUMBER  
    AS  
    l_tst NUMBER; 
    BEGIN 
       l_tst := TO_NUMBER(p_num); 
       if INSTR(p_num,'.') >0 then 
           if SUBSTR(p_num,INSTR(p_num,'.')+1) is null then 
            return 0; 
           else  
            RETURN length(SUBSTR(p_num,INSTR(p_num,'.')+1));     
           end if; 
       else 
           RETURN 0; 
       end if; 
    EXCEPTION 
       WHEN OTHERS THEN 
          RETURN -1; 
    END;

    댓글