In Oracle SQL, I have a set of strings like...
Select 'AX', 'BC' from dual;
I need these strings as separate records as below.
Required Output:
Column1
---------------
AX
BC
In Oracle SQL, I have a set of strings like...
Select 'AX', 'BC' from dual;
I need these strings as separate records as below.
Required Output:
Column1
---------------
AX
BC
In Oracle, you can try this
with mydata as
(select q'[AX,BC]' mycol from dual)
select regexp_substr(mycol, '[^,]+', 1, level) result from mydata
connect by level <= length(regexp_replace(mycol, '[^,]+')) + 1;
One way would be like this
with t as (Select 'AX' col1, 'BC' col2 from dual)
select col1 from t
union
select col2 from t
Please check the below code. Hope this helps to achieve your results.
with table1 as
(Select 'AX,BC' as data1 from dual)
SELECT REGEXP_SUBSTR(data1, '[^,]+', 1, LEVEL) TXT
FROM table1
CONNECT BY level <= length(regexp_replace(data1, '[^,]+')) + 1;