Split Comma Separated String
-- Using Oracle XML functions to split comma separated string into 
-- individual elements

SELECT
  TRIM(EXTRACT(column_value, '/e/text()')) as abbr_month
FROM 
 (SELECT 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec' months_of_year 
  FROM DUAL) qt,
 TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE('<ROW><e>'||
        REPLACE(qt.months_of_year, ',','</e><e>')||
         '</e></ROW>'),'/ROW/e')))
;

  Oracle XML Functions

  XMLAgg To Build String

  LISTAGG (12c) - To Build String

  Oracle PL/SQL Utility DBMS_UTILITY.Comma_to_Table

Oracle registered trademark of Oracle Corporation.

Last Revised On: August 31,st, 2014

  344