You can use regexp_substr (). Example:
create or replace type splitTable_Type is table of varchar2(100); declare l_split_table splitTable_Type; begin select regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) bulk collect into l_split_table from dual connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null; end;
The query iterates through a string separated by commas, searches for a comma (,), and then breaks the string, treating the comma as a separator. It returns a string as a string, whenever it hits the delimiter.
level in the regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) expression regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) refers to the pseudo-column in Oracle, which is used in a hierarchical query to identify the hierarchy level in numeric format: level in the connection
ferralucho May 2 '18 at 20:36 2018-05-02 20:36
source share