we have SQL query that use LISTAGG and WITHIN GROUP in racle 12c. we wan to run the same query in Oracle 10 G. how should I convert that sql query?
Select x.company,
sum(x.dom_amount) as dom_amount,
sum(x.curr_amount) as curr_amount,
LISTAGG(x.accounting_year, '; ') WITHIN GROUP (ORDER BY x.accounting_year) accounting_year,
LISTAGG(x.accounting_period, '; ') WITHIN GROUP (ORDER BY x.accounting_period) accounting_period,
count(x.voucher_no) no_of_vouchers,
LISTAGG(x.voucher_no, '; ') WITHIN GROUP (ORDER BY x.voucher_no) voucher_no,
LISTAGG(x.voucher_type, '; ') WITHIN GROUP (ORDER BY x.voucher_type) voucher_type
from
(Select a.company,
(NVL(a.debet_amount,0) - NVL(a.credit_amount,0)) dom_amount,
(NVL(a.currency_debet_amount,0) - NVL(a.currency_credit_amount,0)) curr_amount
from gen_led_voucher_row_tab a
where a.trans_code IN ('AFP1', 'AFP2', 'AFP5', 'AFP6', 'AFP7', 'AFP8')
union all
Select a.company,
(NVL(a.debet_amount,0) - NVL(a.credit_amount,0)) dom_amount,
(NVL(a.currency_debet_amount,0) - NVL(a.currency_credit_amount,0)) curr_amount
from voucher_row_tab a
where a.trans_code IN ('AFP1', 'AFP2', 'AFP5', 'AFP6', 'AFP7', 'AFP8')
group by x.company,x.reference_serie,x.reference_number, x.trans_code,