I have a column in a table that will have values separated by commas. It appears that the maximum number of entries is 5, but I am not certain of that. I need a way to select the individual values at and put each entry in its own column. It is a select statement only, not building a new table.
create table commasplit (agentname varchar2(40), categories varchar2(100));
insert into commasplit (select 'Alice', 'cat01, cat02, cat03' from dual);
insert into commasplit (select 'Bob', 'cat04, cat05' from dual);
insert into commasplit (select 'Carl', 'cat02, cat06, cat01, cat11' from dual);
So I would like to select it so that I get these results:
AGENT CATA CATB CATC CATD
Alice cat01 cat02 cat03 null
Bob cat04 cat05 null null
Carl cat02 cat06 cat01 cat11