Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

String to Row: Delimiter as part of the value

Karthick2003Mar 10 2010 — edited Mar 11 2010
My DB Version - 10.2.0.4.0

I have a string like this
with t
as
(
select q'['My column',LPAD(TRIM(my_column),4,'0'),10,10000]' str
  from dual
)
select * from t
I am looking for a SQL solution that will convert this string into row like this
'My column'
LPAD(TRIM(my_column),4,'0')
10
10000
Normal way to convert delimited string to row would be like this
with t
as
(
select q'['My column',LPAD(TRIM(my_column),4,'0'),10,10000]' str
  from dual
)
select regexp_substr(str,'[^,]+',1,level) val 
  from t
connect by level <= length(str)-length(replace(str,','))+1
But this would result in
'My column' 
LPAD(TRIM(my_column) 
4 
'0') 
10 
10000 
But this is incorrect. So any idea how to solve it?
This post has been answered by Frank Kulash on Mar 10 2010
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 8 2010
Added on Mar 10 2010
14 comments
4,200 views