Prasad
Prasad

Reputation: 65

how to pass column name of a table to the table valued function in Oracle 10g?

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

Answers (1)

DazzaL
DazzaL

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

Related Questions