SELECT ct.org_id ,ct.attribute1 bu_id --核算主体编号 ,ct.attribute2 dept_id --部门编号 ,hca.account_number ,hp.party_name --收单方 ,ct.attribute3 --项目编号 ,pa.long_name --项目 ,to_char(ct.trx_date) trx_date ,to_char(gd.gl_date) gl_date ,ct.trx_number --编号 ,rc.name --事务处理类型 ,ct.invoice_currency_code --币种 ,ct.exchange_rate --汇率 ,hp.attribute2 group_customer --集团客户 ,ct.attribute8 final_customer_code --最终客户 ,zl.tax_rate_code tax_rate_code --税率名称 ,zl.tax_amt tax_amt --税额 ,ct.attribute15 outside_system --外围系统ID FROM ra_cust_trx_types_all rc, ar.ra_customer_trx_all ct, ra_cust_trx_types_all ctt, ra_cust_trx_line_gl_dist_all gd, hz_cust_accounts hca, hz_parties hp, hz_cust_site_uses_all hcs, pa_projects_all pa, ra_customer_trx_lines_all ctl, zx_lines zl WHERE rc.org_id = ct.org_id AND ctl.customer_trx_id = ct.customer_trx_id AND ctl.org_id = ct.org_id AND rc.cust_trx_type_id = ct.cust_trx_type_id AND ct.customer_trx_id = gd.customer_trx_id and ctl.tax_line_id = zl.tax_line_id AND 'REC' = gd.account_class AND 'Y' = gd.latest_rec_flag AND ct.cust_trx_type_id = ctt.cust_trx_type_id AND ctt.type <> 'BR' AND ctt.org_id = ct.org_id AND ct.bill_to_customer_id = hca.cust_account_id AND hca.party_id = hp.party_id AND ct.bill_to_site_use_id = hcs.site_use_id AND ct.org_id = pa.org_id(+) AND ct.attribute3 = pa.segment1(+);