'The result of string concatenation is too long (LISTAGG) [duplicate]
I'm havin trouble while trying to execute this query because it says: "result of string concatenation is too long"
I'm using Oracle database
The SQL Query:
select *
from (
select
v.*
,min(cnt_org)over(partition by accountnumber) min_cnt_org
,max(cnt_org)over(partition by accountnumber) max_cnt_org
from (
select
accountnumber
,org_id
,count(org_id) over(partition by accountnumber) cnt
,count(distinct org_id) over(partition by accountnumber) cnt_distinct
,count(*) over(partition by accountnumber,org_id) cnt_org
,listagg(org_id,',')within group(order by org_id)
over(partition by accountnumber)
as orgs
from mytable
) v
) v2
where cnt_distinct<>3
or min_cnt_org!=max_cnt_org;
How can i make it run?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

