달력

12025  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

특정문자로 뒤에서부터 substring 하는 function

CREATE OR REPLACE FUNCTION LAST_FIELD (
    V_FIELD IN VARCHAR2,
    V_DELIMITER IN VARCHAR2
) RETURN VARCHAR2
IS
    format_field VARCHAR2(100);
/******************************************************************************
   NAME:       LAST_FIELD
   PURPOSE:   

   REVISIONS:
   Ver        Date        Author           Description
   ---------  ----------  ---------------  ------------------------------------
   1.0        2008-09-09          1. Created this function.

   NOTES:

   Automatically available Auto Replace Keywords:
      Object Name:     LAST_FIELD
      Sysdate:         2008-09-09
      Date and Time:   2008-09-09, 오전 10:16:36, and 2008-09-09 오전 10:16:36
      Username:         (set in TOAD Options, Procedure Editor)
      Table Name:       (set in the "New PL/SQL Object" dialog)

******************************************************************************/
BEGIN
    format_field := TRIM(SUBSTR(V_FIELD, INSTR(V_FIELD, V_DELIMITER, -1) +1));
    RETURN format_field;
    EXCEPTION
        WHEN NO_DATA_FOUND THEN
            NULL;
        WHEN OTHERS THEN
            RAISE;
END LAST_FIELD;

Posted by marryjane
|