Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Merging results

Re: Merging results

From: Chuck Hamilton <chuck_hamilton_at_yahoo.com>
Date: Tue, 27 Jun 2000 11:12:59 -0700 (PDT)
Message-Id: <10541.110562@fatcity.com>


--0-424238335-962129579=:11222
Content-Type: text/plain; charset=us-ascii

I'm not sure what you mean. If you mean you want to append a | to all rows the answer is simple...

select docnum||'|' from ...;

If you mean you want a new column for each row returned there is no way to do it in SQL without first knowing the number of rows being converted into columns. I think something like that would best be handled with a spreadsheet. You could probably do it in Unix too by piping the results of the query through awk and/or sed to build in "insert" or "create table as select... from dual" statement.

  Andreas Jung <ajung_at_sz-sb.de> wrote:
Assume a query like "select docnum from ....." returns a lot of rows. I need to concatenate the docnum column of all rows with "|" and store them in a single new row of another table. What is the fastest way to do this ?

Andreas

-- 
Author: Andreas Jung
INET: ajung_at_sz-sb.de

Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).


---------------------------------
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
--0-424238335-962129579=:11222
Content-Type: text/html; charset=us-ascii


<P>I'm not sure what you mean. If you mean you want to append a | to all rows the answer is simple...</P>
<P>select docnum||'|' from ...;</P>
<P>If you mean you want a new column for each row returned there is no way to do it in SQL without first knowing the number of rows being converted into columns. I think something like that would best be handled with a spreadsheet. You could probably do it in Unix too by piping the results of the query through awk and/or sed to build in "insert" or "create table as select... from dual" statement.</P>
<P>&nbsp; <B><I>Andreas Jung &lt;ajung_at_sz-sb.de&gt;</I></B> wrote: <BR>
<BLOCKQUOTE style="BORDER-LEFT: #1010ff 2px solid; MARGIN-LEFT: 5px; PADDING-LEFT: 5px">Assume a query like "select docnum from ....." returns<BR>a lot of rows. I need to concatenate the docnum column of<BR>all rows with "|" and store them in a single new row<BR>of another table. What is the fastest way to do this ?<BR><BR>Andreas<BR>-- <BR>Author: Andreas Jung<BR>INET: ajung_at_sz-sb.de<BR><BR>Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051<BR>San Diego, California -- Public Internet access / Mailing Lists<BR>--------------------------------------------------------------------<BR>To REMOVE yourself from this mailing list, send an E-Mail message<BR>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in<BR>the message BODY, include a line containing: UNSUB ORACLE-L<BR>(or the name of mailing list you want to be removed from). You may<BR>also send the HELP command for other information (like subscribing).</BLOCKQUOTE><p><br><hr size=1><b>Do You Yahoo!?<!
/b><br> Get Yahoo! Mail - Free email you can access from anywhere!
Received on Tue Jun 27 2000 - 13:12:59 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US