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: Concatenate rows

RE: Concatenate rows

From: Abdul Aleem <abchaudhary-ho_at_beaconhouse.edu.pk>
Date: Fri, 30 Mar 2001 20:01:43 -0800
Message-ID: <F001.002DD9C7.20010330194020@fatcity.com>

Wendy,

If I understood you correctly,

You need to create a cursor, then scan it in a loop and have column(s) of each row concatenated to a variable. The variable I feel has to be a varchar2 with enough size to hold the data of all the rows.

Just curious, apparently this does not seem to be a good thing to do, if you could kindly share why do you want to do this.

HTH! Aleem,

 -----Original Message-----
Sent: Friday, March 30, 2001 8:36 PM

To:     Multiple recipients of list ORACLE-L
Subject:        Re: Concatenate rows

Hi Wendy,

Here's an example from a PL/SQL procedure:

        inputFromDate := startMonth||'/'||startDay||'/'||startYear;

The '/' is a delimiter, if you don't want one just use:

        inputFromDate := startMonth||startDay||startYear;

The individual data elements in this case were user input on a web browser, but the same syntax applies if the elements had been selected from tables.

Hope this helps.

David A. Barbour
Oracle DBA, OCP

Wendy Y wrote:
>
> Hello:
>
> Is there a way that we can Concatenate several rows (say 6 rows from a
> select statement) into one variable?
>
> Thanks
>
> Wendy
>
> ----------------------------------------------------------------------
> Do You Yahoo!?
> Yahoo! Mail Personal Address - Get email at your own domain with
> Yahoo! Mail.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: David A. Barbour
  INET: dbarbour_at_nucentrix.net

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).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Abdul Aleem
  INET: abchaudhary-ho_at_beaconhouse.edu.pk

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).
Received on Fri Mar 30 2001 - 22:01:43 CST

Original text of this message

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