Reputation: 65
In a table I have comma separated values and I have to change these values into rows.
Ex: MSGVALUES column
145,24,56,78 23,45,67
Expected output for this
MSGVALUES column
145
24
56
78
23
45
67
I got the above result by using table valued function(CSV) from Google search.
select * from table (CSV('10,20,'34',',')
If I execute CSV function then I am getting the result like
1
20
34
Now my actual requirement is I have to apply the above CSV function to my column name ie.MSG VALUE column. Assume my table name is CODEDESC
Upvotes: 0
Views: 477
Reputation: 21973
so you'd join the table()
cast to your table like:
select csv.*
from your_tab t, table(csv(t.msgvalues, ',')) csv;
Upvotes: 1