Skip site navigation (1) Skip section navigation (2)

Re: can somebody execute this query on Oracle 11.2g and send result?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: can somebody execute this query on Oracle 11.2g and send result?
Date: 2010-01-29 07:32:53
Message-ID: 162867791001282332t1227b2b8j9585a978862c974d@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
2010/1/29 Jonah H. Harris <jonah(dot)harris(at)gmail(dot)com>:
> On Thu, Jan 28, 2010 at 9:10 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
>>
>> Hello,
>>
>> I can't to install Oracle, and need to know result.
>>
>> CREATE TABLE foo(a varchar(10), b varchar(10));
>>
>> INSERT INTO foo VALUES('aaa',',');
>> INSERT INTO foo VALUES('bbb',';');
>> INSERT INTO foo VALUES('ccc','+');
>>
>> SELECT listagg(a,b) FROM foo;
>
> That's not how listagg works.
>
> The syntax is listagg(expression [, delimiter]) WITHIN GROUP (order by
> clause) [OVER partition clause]
> If a delimiter is defined, it must be a constant.
>
> Query: SELECT listagg(a, ',') WITHIN GROUP (ORDER BY a) FROM foo;
> Result: aaa,bbb,ccc
>
> Query: SELECT listagg(a, ';') WITHIN GROUP (ORDER BY a) FROM foo;
> Result: aaa;bbb;ccc
>
> Query: SELECT listagg(a, '+') WITHIN GROUP (ORDER BY a) FROM foo;
> Result: aaa+bbb+ccc
>

Thank You very much

Pavel

> --
> Jonah H. Harris
>

In response to

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2010-01-29 07:43:48
Subject: Re: Review: listagg aggregate
Previous:From: Takahiro ItagakiDate: 2010-01-29 07:29:30
Subject: Re: 64-bit size pgbench

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group