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

fac586

helpme_helpyou wrote:

I created select list with the data I have. But, i get two empty rows (selection) before the actual names i want to get shown. Can anyone help me with it, please?

What are the settings for the Display Extra Values and Display Null Values properties on the select list item? (Read the online help for these properties while you're there).

3474044

They were YES, but I just changed them to NO. Even tho, i still have one empty selection. (one of them removed already and thanks for helping)

Capture.PNGCapture1.PNG

fac586

helpme_helpyou wrote:

They were YES, but I just changed them to NO. Even tho, i still have one empty selection. (one of them removed already and thanks for helping)

So what's in the data? Run the LOV query in SQL Workshop.

3474044

how can i do that? i have never done that and i am new on APEX.

thanks for your help!

fac586

helpme_helpyou wrote:

how can i do that? i have never done that and i am new on APEX.

3474044

Thanks for the steps! I got four rows which includes one extra (empty row). How can i avoid that one? Please, see the following screenshot for the results.

Capture.PNG

3474044

I found the problem. I added additional column without putting Location type into it. I think it causes it to show one empty selection.

Thanks for helping

fac586

helpme_helpyou wrote:

Thanks for the steps! I got four rows which includes one extra (empty row). How can i avoid that one?

I have no idea because I have no knowledge of the data model. However, the LOV query indicates that the data model is not properly normalized, providing further evidence that it is probably wrong.

3474044
Answer

i found the problem. It should be there (the one of the empty selection), because the user also may choose nothing for that which required empty selection. can you please help me with another question which i just shared 5-10 mins ago? thanks again for helping!

Marked as Answer by 3474044 · Sep 27 2020
1 - 9
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,209 views