Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Getting all rows of sqlplus output on one line
Forgot, you can replace ',' with ';' in SYS_CONNECT_BY_PATH(site_id,
','), if you need ';' as a separator.
Also, credit for this solution (if I remember correctly) goes to Tom
Kyte.
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Igor Neyman
Sent: Thursday, October 05, 2006 2:02 PM
To: Rodd.Holman_at_gmail.com; oracle-l_at_freelists.org
Subject: RE: Getting all rows of sqlplus output on one line
If you look at it as a db problem (not Windows problem), you could try something like this:
with T AS (
SELECT SYS_CONNECT_BY_PATH(site_id, ',') text, CONNECT_BY_ISLEAF FROM ( select 1 verse, rownum piece, site_id from site_list_table
where definition_id in (nnnn, nnn2, nnn3) order by site_id)
WHERE CONNECT_BY_ISLEAF = 1 CONNECT BY verse = PRIOR verse AND piece - 1 = PRIOR piece START WITH piece = 1 )
Igor
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Rodd Holman
Sent: Thursday, October 05, 2006 1:45 PM
To: oracle-l_at_freelists.org
Subject: Getting all rows of sqlplus output on one line
OK, I've been searching the docs (docs.oracle.com) and trying to figure
out how to make this work from sqlplusw.exe. I'll let it be known from
the first that I despise Windows and hate working in it. Here's the
case:
We have Business Objects as a reporting tool. One of our power users
wants to be able to enter in a list of site_id's into one of the
parameter fields. Current selection capability is *ALL* or individual
site_id. However, the tool lets you paste a ";" separated list into it.
Running the following
select site_id||';'
from site_list_table
where definition_id in (nnnn, nnn2, nnn3) order by site_id;
returns (as expected)
site_id||';'
From the UNIX/LINUX side I can select this list and paste it directly into the browser field for site_id and it works.
From the windows side it only pastes the first value because sqlplusw outputs with CRLF or something like that.
Does anyone have a way of returning this variable # of records in one output string? I've done some playing with decode trying to flip it, but it's not getting me where I want to be. The list of site_id's is dynamic, so to specifically code the decode to do a crostab would need me to re-write it each time the list changed. I don't want to get that involved with this user.
I really hate Windows!!!
Thanks
Rodd
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Thu Oct 05 2006 - 13:30:16 CDT
![]() |
![]() |