LISTAGG Query Question

Avatar
  • updated
  • Completed

Is there a way to rewrite the query so it does not give me the error below?

Invalid Select statement Unexpected token "over" at line 4, pos 1.

In my app that uses Active Query builder I get another message:

Invalid Select statement Unexpected token "(" at line 3, pos 31.

The following query runs successfully and provides the expected output in Flyspeed and in my app when I run it in pass-through mode.

SELECT DISTINCT

C1,

LISTAGG(C2, ', ') WITHIN GROUP(order by C1, C2)

over (partition by C1) C2

FROM

(

SELECT 'Flower' C1, 'Rose' C2

FROM dual

UNION

SELECT 'Flower' C1, 'Daisy' C2

FROM dual

UNION

SELECT 'Tree' C1, 'Oak' C2

FROM dual

UNION

SELECT 'Tree' C1, 'Pine' C2

FROM dual

UNION

SELECT 'Tree' C1, 'Maple' C2

FROM dual

)

ORDER BY C1

Avatar
Anonymous
C1 C2
Flower Daisy, Rose
Tree Maple, Oak, Pine

Avatar
Anonymous

Hi,

Please let me know your Connection Type and SQL Syntax (if applicable) settings from Connection Properties dialog.

Avatar
Kelly

Oracle

I don't have anything special setup for SQL Syntax. I used the defaults.

Avatar
Anonymous

The problem is fixed. Thank you for reporting.