0
votes

I want to handle a query that returns a varchar, split comma separated values and be able to convert each one into an integer that will be stored in a local table variable. In SQL Server I have accomplished this as follows:

DECLARE @values TABLE(col INT not null)  
INSERT INTO @values SELECT value FROM STRING_SPLIT(@list, ',')

where @list is the query result. How can I achieve the same result in Oracle,as in copying the functionality of String_split table-valued function? Is there something similar with that in Oracle?
I don't want to do it differently cause the change in the code must be as minimal as possible.

There are several versions here - and you can create a function (e.g. as shown in the accepted answer) with the same name as the SQL Server function, if that won't be confusing. - Alex Poole