Hello ,
I am using oracle version 12c .
My code is as follows :
with employee_list as (
SELECT listagg(e1.first_name, ',' on overflow truncate) within group (order by e1.first_name) AS LISTFNAME,
WM_CONCAT (
DISTINCT
CASE
WHEN e1.family_active = 'Y'
OR e1.family_id IS NULL
THEN
e1.middle_name
ELSE
NULL
END)
AS LISTFNAME_2
,deptname
FROM employees e1
group by deptname)
SELECT CASE
WHEN e.LISTFNAME IS NOT NULL
THEN
CASE
WHEN e.LISTFNAMES_2 NOT NULL THEN e.LISTFNAME||','||e.LISTFNAMES_2
ELSE e.LISTFNAME
END
ELSE
CASE
WHEN e.LISTFNAMES_2 IS NOT NULL THEN e.LISTFNAMES_2
ELSE NULL
END
END
from departments d, employee_list e
where d.dept_name = e.deptname
------
I am getting the following error :
ORA-01489: result of string concatenation is too long
01489. 00000 - "result of string concatenation is too long"
*Cause: String concatenation result is more than the maximum size.
*Action: Make sure that the result is less than the maximum size.