1. 程式人生 > >Oracle EBS AR 客戶取數SQL

Oracle EBS AR 客戶取數SQL

SELECT acct.cust_account_id,
       acct.party_id,
       acct.account_number,
       party.party_name,
       lkp1.meaning                    party_type,
       profile.cust_account_profile_id,
       acct.account_name,
       party.party_number,
       party.category_code,
       lkp.meaning                     category,
       party.jgzz_fiscal_code,
       party.ATTRIBUTE11
  
FROM hz_cust_accounts acct, hz_parties party, hz_customer_profiles profile, fnd_lookup_values lkp, ar_lookups lkp1 WHERE /*acct.cust_account_id = :1 AND*/ acct.party_id = party.party_id AND acct.cust_account_id = profile.cust_account_id
AND profile.site_use_id IS NULL AND lkp1.lookup_type = 'PARTY_TYPE' AND lkp1.lookup_code = party.party_type AND trunc(SYSDATE) BETWEEN trunc(lkp1.start_date_active) AND nvl(trunc(lkp1.end_date_active), trunc(SYSDATE)) AND
party.category_code = lkp.lookup_code(+) AND lkp.lookup_type(+) = 'CUSTOMER_CATEGORY' AND lkp.language(+) = userenv('LANG')