SELECT cm.trx_number
,fnd_flex_ext.get_segs('SQLGL', 'GL#', gcc.chart_of_accounts_id, ad.code_combination_id) account_number
,ra.gl_date
,ct.trx_number applied_trx_number
,ad.acctd_amount_dr
,ad.acctd_amount_cr
FROM ar_distributions_all ad
,ar_receivable_applications_all ra
,ar_payment_schedules_all ps
,ra_customer_trx_all cm
,ra_customer_trx_all ct
,gl_code_combinations gcc
WHERE ad.source_table = 'RA'
AND ad.source_type = 'REC'
AND ad.source_id = ra.receivable_application_id
AND ra.customer_trx_id = cm.customer_trx_id
AND gcc.code_combination_id = ad.code_combination_id
AND ra.applied_payment_schedule_id = ps.payment_schedule_id
AND ps.customer_trx_id = ct.customer_trx_id(+);
来源:oschina
链接:https://my.oschina.net/u/4374628/blog/3740326