From: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(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 05:47:51 |
Message-ID: | 36e682921001282147v5c9c4426y7a5dc24bf63340cb@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
--
Jonah H. Harris
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Bailey | 2010-01-29 06:09:38 | Re: XQuery support |
Previous Message | Boszormenyi Zoltan | 2010-01-29 05:32:20 | Re: out-of-scope cursor errors |