Search This Blog

Sunday, June 3, 2018

Oracle Rows Generate from Column Value


Example

 Select COLUMN1,COLUMN2,
               From (
               select COLUMN1,COLUMN2,
                   regexp_substr(STRING_COLUMN,'[^,]+',1,column_value) as STR
                  from SAMPLE_TABLE
                        TABLE(cast(multiset(select level
                       from dual
                        connect by level <= length(DAYS) -
                                length(replace(DAYS,','))+1)
                               as sys.odcinumberlist))               
               )  Where ,COLUMN2=P_COLUMN2 and STR Is Not Null Order By 1,3