SELECT (SELECT name FROM v$database) instance,
ct.trx_number, -- ct.interface_header_attribute1, ct.interface_header_attribute3,
ct.old_trx_number, hou.name ou_name,
ct.recurred_from_trx_number,
ct.trx_date,
ct.batch_id,
ct.batch_source_id,
ct.reason_code,
ct.term_id,
ct.complete_flag,
ct.invoice_currency_code,
ct.purchase_order,
rac_bill_party.party_name bill_party_name,
rac_bill.account_number bill_account_number,
su_bill.LOCATION bill_location,
raa_bill_loc.address1 bill_address1,
raa_bill_loc.address2 bill_address2,
raa_bill_loc.address3 bill_address3,
raa_bill_loc.city bill_city,
raa_bill_loc.county bill_county,
raa_bill_loc.state bill_state,
raa_bill_loc.province bill_province,
raa_bill_loc.postal_code bill_postal_code,
rac_ship_party.party_name ship_party_name,
rac_ship.account_number ship_account_number,
su_ship.LOCATION bill_location,
raa_ship_loc.address1 ship_address1,
raa_ship_loc.address2 ship_address2,
raa_ship_loc.address3 ship_address3,
raa_ship_loc.city ship_city,
raa_ship_loc.county ship_county,
raa_ship_loc.state ship_state,
raa_ship_loc.province ship_province,
raa_ship_loc.postal_code ship_postal_code,
bs.NAME batch_source_name,
rab.NAME batch_name,
ctt.NAME trx_type_name,
ctt.TYPE trx_type
ct.old_trx_number, hou.name ou_name,
ct.recurred_from_trx_number,
ct.trx_date,
ct.batch_id,
ct.batch_source_id,
ct.reason_code,
ct.term_id,
ct.complete_flag,
ct.invoice_currency_code,
ct.purchase_order,
rac_bill_party.party_name bill_party_name,
rac_bill.account_number bill_account_number,
su_bill.LOCATION bill_location,
raa_bill_loc.address1 bill_address1,
raa_bill_loc.address2 bill_address2,
raa_bill_loc.address3 bill_address3,
raa_bill_loc.city bill_city,
raa_bill_loc.county bill_county,
raa_bill_loc.state bill_state,
raa_bill_loc.province bill_province,
raa_bill_loc.postal_code bill_postal_code,
rac_ship_party.party_name ship_party_name,
rac_ship.account_number ship_account_number,
su_ship.LOCATION bill_location,
raa_ship_loc.address1 ship_address1,
raa_ship_loc.address2 ship_address2,
raa_ship_loc.address3 ship_address3,
raa_ship_loc.city ship_city,
raa_ship_loc.county ship_county,
raa_ship_loc.state ship_state,
raa_ship_loc.province ship_province,
raa_ship_loc.postal_code ship_postal_code,
bs.NAME batch_source_name,
rab.NAME batch_name,
ctt.NAME trx_type_name,
ctt.TYPE trx_type
FROM ra_customer_trx_all ct,
hz_cust_accounts_all rac_bill,
hz_parties rac_bill_party,
hz_cust_accounts_all rac_ship,
hz_parties rac_ship_party,
hz_cust_accounts_all rac_paying,
hz_parties rac_paying_party,
hz_cust_site_uses_all su_bill,
hz_cust_site_uses_all su_ship,
hz_cust_acct_sites_all raa_bill,
hz_party_sites raa_bill_ps,
hz_locations raa_bill_loc,
hz_cust_acct_sites_all raa_ship,
hz_party_sites raa_ship_ps,
hz_locations raa_ship_loc,
hz_relationships raco_ship_rel,
hz_parties raco_bill_party,
hz_relationships raco_bill_rel,
ra_batch_sources_all bs,
ra_batches_all rab,
ra_cust_trx_types_all ctt,
hr_operating_units hou
hz_parties rac_bill_party,
hz_cust_accounts_all rac_ship,
hz_parties rac_ship_party,
hz_cust_accounts_all rac_paying,
hz_parties rac_paying_party,
hz_cust_site_uses_all su_bill,
hz_cust_site_uses_all su_ship,
hz_cust_acct_sites_all raa_bill,
hz_party_sites raa_bill_ps,
hz_locations raa_bill_loc,
hz_cust_acct_sites_all raa_ship,
hz_party_sites raa_ship_ps,
hz_locations raa_ship_loc,
hz_relationships raco_ship_rel,
hz_parties raco_bill_party,
hz_relationships raco_bill_rel,
ra_batch_sources_all bs,
ra_batches_all rab,
ra_cust_trx_types_all ctt,
hr_operating_units hou
WHERE 1 = 1
AND ct.bill_to_customer_id = rac_bill.cust_account_id
AND rac_bill.party_id = rac_bill_party.party_id
AND ct.ship_to_customer_id = rac_ship.cust_account_id(+)
AND rac_ship.party_id = rac_ship_party.party_id(+)
AND ct.paying_customer_id = rac_paying.cust_account_id(+)
AND rac_paying.party_id = rac_paying_party.party_id(+)
AND ct.bill_to_site_use_id = su_bill.site_use_id
AND ct.ship_to_site_use_id = su_ship.site_use_id(+)
AND su_bill.cust_acct_site_id = raa_bill.cust_acct_site_id
AND ct.org_id = hou.organization_id
AND raa_bill.party_site_id = raa_bill_ps.party_site_id
AND raa_bill_loc.location_id = raa_bill_ps.location_id
AND su_ship.cust_acct_site_id = raa_ship.cust_acct_site_id(+)
AND raa_ship.party_site_id = raa_ship_ps.party_site_id(+)
AND raa_ship_loc.location_id(+) = raa_ship_ps.location_id
AND raco_bill_rel.subject_table_name(+) = 'HZ_PARTIES'
AND raco_bill_rel.object_table_name(+) = 'HZ_PARTIES'
AND raco_bill_rel.directional_flag(+) = 'F'
AND raco_bill_rel.subject_id = raco_bill_party.party_id(+)
AND raco_ship_rel.subject_table_name(+) = 'HZ_PARTIES'
AND raco_ship_rel.object_table_name(+) = 'HZ_PARTIES'
AND raco_ship_rel.directional_flag(+) = 'F'
AND ct.batch_source_id = bs.batch_source_id
AND ct.batch_id = rab.batch_id(+)
AND ct.cust_trx_type_id = ctt.cust_trx_type_id
AND ctt.org_id = ct.org_id
AND bs.org_id = ct.org_id
--AND ct.trx_number IN ('8612110138', '8612110083', '8612180120', '8612180140')
AND rac_bill_party.party_name = 'HD HYUNDAI INFRACORE'
GROUP BY ct.trx_number,
ct.old_trx_number, hou.name,
ct.recurred_from_trx_number,
ct.trx_date,
ct.batch_id,
ct.batch_source_id,
ct.reason_code,
ct.term_id,
ct.complete_flag,
ct.invoice_currency_code,
ct.purchase_order,
rac_bill_party.party_name ,
rac_bill.account_number ,
su_bill.LOCATION ,
raa_bill_loc.address1 ,
raa_bill_loc.address2 ,
raa_bill_loc.address3 ,
raa_bill_loc.city ,
raa_bill_loc.county ,
raa_bill_loc.state ,
raa_bill_loc.province ,
raa_bill_loc.postal_code ,
rac_ship_party.party_name ,
rac_ship.account_number ,
su_ship.LOCATION ,
raa_ship_loc.address1 ,
raa_ship_loc.address2 ,
raa_ship_loc.address3 ,
raa_ship_loc.city ,
raa_ship_loc.county ,
raa_ship_loc.state ,
raa_ship_loc.province ,
raa_ship_loc.postal_code ,
bs.NAME,
rab.NAME,
ctt.NAME,
ctt.TYPE;
AND rac_bill.party_id = rac_bill_party.party_id
AND ct.ship_to_customer_id = rac_ship.cust_account_id(+)
AND rac_ship.party_id = rac_ship_party.party_id(+)
AND ct.paying_customer_id = rac_paying.cust_account_id(+)
AND rac_paying.party_id = rac_paying_party.party_id(+)
AND ct.bill_to_site_use_id = su_bill.site_use_id
AND ct.ship_to_site_use_id = su_ship.site_use_id(+)
AND su_bill.cust_acct_site_id = raa_bill.cust_acct_site_id
AND ct.org_id = hou.organization_id
AND raa_bill.party_site_id = raa_bill_ps.party_site_id
AND raa_bill_loc.location_id = raa_bill_ps.location_id
AND su_ship.cust_acct_site_id = raa_ship.cust_acct_site_id(+)
AND raa_ship.party_site_id = raa_ship_ps.party_site_id(+)
AND raa_ship_loc.location_id(+) = raa_ship_ps.location_id
AND raco_bill_rel.subject_table_name(+) = 'HZ_PARTIES'
AND raco_bill_rel.object_table_name(+) = 'HZ_PARTIES'
AND raco_bill_rel.directional_flag(+) = 'F'
AND raco_bill_rel.subject_id = raco_bill_party.party_id(+)
AND raco_ship_rel.subject_table_name(+) = 'HZ_PARTIES'
AND raco_ship_rel.object_table_name(+) = 'HZ_PARTIES'
AND raco_ship_rel.directional_flag(+) = 'F'
AND ct.batch_source_id = bs.batch_source_id
AND ct.batch_id = rab.batch_id(+)
AND ct.cust_trx_type_id = ctt.cust_trx_type_id
AND ctt.org_id = ct.org_id
AND bs.org_id = ct.org_id
--AND ct.trx_number IN ('8612110138', '8612110083', '8612180120', '8612180140')
AND rac_bill_party.party_name = 'HD HYUNDAI INFRACORE'
GROUP BY ct.trx_number,
ct.old_trx_number, hou.name,
ct.recurred_from_trx_number,
ct.trx_date,
ct.batch_id,
ct.batch_source_id,
ct.reason_code,
ct.term_id,
ct.complete_flag,
ct.invoice_currency_code,
ct.purchase_order,
rac_bill_party.party_name ,
rac_bill.account_number ,
su_bill.LOCATION ,
raa_bill_loc.address1 ,
raa_bill_loc.address2 ,
raa_bill_loc.address3 ,
raa_bill_loc.city ,
raa_bill_loc.county ,
raa_bill_loc.state ,
raa_bill_loc.province ,
raa_bill_loc.postal_code ,
rac_ship_party.party_name ,
rac_ship.account_number ,
su_ship.LOCATION ,
raa_ship_loc.address1 ,
raa_ship_loc.address2 ,
raa_ship_loc.address3 ,
raa_ship_loc.city ,
raa_ship_loc.county ,
raa_ship_loc.state ,
raa_ship_loc.province ,
raa_ship_loc.postal_code ,
bs.NAME,
rab.NAME,
ctt.NAME,
ctt.TYPE;
No comments:
Post a Comment