Toad World® Forums

inserting sub query into one row help?


#1

hello all,

So am i trying to insert some code into one row and have been unable to unearth any solution. I would appreciate any help.

So all I want to do is insert the following code into one row of a table that i have created. As of right now it creates 8 rows instead of 1.

Code:

insert into cody_list (list_code)
select * from (
select ‘<GLOBALLIST name=’ || ‘"’ || ‘Products’ || ‘">’
from products
where rownum = 1

union all select
‘<LISTITEM value=’ || ‘"’ || name || ‘"/>’
from products
where visible = ‘Y’

union ALL select
‘’
FROM PRODUCTS
WHERE ROWNUM = 1) ;

thanks in advance,

Shabazz


#2

As of right now it creates 8 rows instead of 1.

If you run

select * from (…

to th end

You’ll see that you get 8 records (rows)

So change that part to get only one row.

:slight_smile: