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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Sql for generating one string out of several records

Re: Sql for generating one string out of several records

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sun, 7 Oct 2001 22:21:59 +0200
Message-ID: <ts1kk5na0t381@news.demon.nl>

"Sindre Idsal" <sidsal_at_online.no> wrote in message news:9W0w7.11674$tu6.274758_at_news1.oke.nextra.no...
> I have a situation where I've got a table with say two coloumns, named
> GROUP_NAME and TEXT.
> So a sample content of this table might be:
> GROUP_NAME TEXT
> ----------------------------------------
> GRP1 London
> GRP1 Washington
> GRP1 Hamburg
> GRP2 Sunday
> GRP2 Monday
> GRP2 Wednesday
>
> I need a sql something like this:
>
> select ...(something....)
> from DEMO_TABLE
> where GROUP_NAME = 'GRP1'
>
> and this should give me a string like this: 'London,Washington,Hamburg'
>
> I know that I can write a function which has GroupName as an
inputparameter
> and that returns the wanted string. But I need to be able to solve this
> problem with an ordinary sql - ie without any userdefined function.
>
> I would appreciate very much any help on this matter.
>
> Regards Sindre Idsal
>
>

You won't be able to do this, as the number of records which satisfy your condition seems to be unknown and unlimited. The only way to do this is the userdefined function.

Regards,

Sybrand Bakker, Senior Oracle DBA Received on Sun Oct 07 2001 - 15:21:59 CDT

Original text of this message

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