This forum is currently locked. You can't register or post questions at this time. (read more)

User defined aggregate functions in PIVOT

All posts relating to Oracle PL/SQL development.

Moderator: Tim...

yuriynv
Member
Posts: 1
Joined: Tue Oct 16, 2012 12:46 pm

User defined aggregate functions in PIVOT

Postby yuriynv » Tue Oct 16, 2012 12:57 pm

Hello

I've implemented an user defined aggregate function that concates strings as suggested here http://www.oracle-base.com/articles/mis ... niques.php.

This function works fine in ordinary SELECTs

select name,stragg(text_value)
from d_run_attr
where run_id in (19586660,19650792)
group by name

but whenever I use it in PIVOT clause

SELECT *
FROM (select a.name,
a.text_value
from d_run_attr a)
PIVOT (STRAGG(b.text_value)
FOR (name) IN ('STATUS','WORKLISTNAME') )

I always get
Error report:
SQL Error: ORA-56902: expect aggregate function inside pivot operation

Could anyone help me and explain what's wrong?

Best regards, Yury

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: User defined aggregate functions in PIVOT

Postby Tim... » Tue Oct 16, 2012 1:14 pm

Hi.

Maybe PIVOT doesn't support user-defined aggregate functions. If you are using 11gR2, you can try LISTAGG. If not, then I suggest you contact Oracle Support for confirmation.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog


Return to “Oracle SQL and PL/SQL Development”

Who is online

Users browsing this forum: No registered users and 5 guests

cron