Я новичок в использовании функции LISTAGG
. Когда я запускаю следующий сценарий, я получаю ошибку неверного идентификатора:
ORA-00904: «TE». «COUNTRY»: недопустимый идентификатор.
Есть идеи, почему?
SELECT te.country, listagg(te.exception_date, ' ,') WITHIN GROUP (ORDER BY te.country) country
FROM
(select unique te.exception_date,
case when te.country is null then (select max(tt.country) from tt_transport tt where te.route = tt.route) else te.country end country
from tt_exception te
where trunc(te.exception_date) > '01-JAN-2015'
and te.plant = 'Z'
and not case when te.country is null then (select max(tt.country) from tt_transport tt where te.route = tt.route) else te.country end is null
order by te.country) te
group by te.country
UNION ALL
SELECT te.country, listagg(te.exception_date, ' ,') WITHIN GROUP (ORDER BY te.country) country
FROM
(select unique te.exception_date, 'GB' country
from tt_exception te
where trunc(te.exception_date) > '01-JAN-2015'
and te.plant = 'W'
and te.country is null
order by te.country)
group by te.country
tt_exception
столбец с именемcountry
? - person Florin Ghita   schedule 28.01.2016