select hca.cust_account_id,
hca.party_id,
hcas.party_site_id,
site_use_id,
hcsu.org_id,
hca.account_number,
hca.account_name,
hps.party_site_number,
location bill_location,
creditcardeo.card_issuer_code "CARD TYPE",
creditcardeo.ccnumber "CARD NUMBER",
chname,
trunc(ipiu.start_date) "VALID FROM",
trunc(creditcardeo.expirydate) "EXP DATE",
expired_flag,
active_flag,
hp.party_name "OWNER NAME",
hcsu.location,
hl.address1,
hl.address2,
hl.city,
hl.state,
hl.postal_code,
creditcardeo.description "CARDHOLDER NAME",
creditcardeo.invalidation_reason,
(select iss.segment_cipher_text
from apps.iby_fndcpt_tx_extensions extn,
iby.iby_security_segments iss
where extn.instr_assignment_id = ipiu.instrument_payment_use_id
and extn.instr_code_sec_segment_id = iss.sec_segment_id
and rownum = 1) cvv
from apps.hz_cust_accounts_all hca,
apps.hz_cust_acct_sites_all hcas,
apps.hz_cust_site_uses_all hcsu,
apps.hz_party_site_uses hpsu,
apps.iby_creditcard creditcardeo,
apps.iby_pmt_instr_uses_all ipiu,
apps.hz_parties hp,
hz_locations hl,
hz_party_sites hps
where hca.party_id = hp.party_id
and hps.party_site_id = hcas.party_site_id
and hps.location_id= hl.location_id
and hca.cust_account_id = hcas.cust_account_id
and hcas.cust_acct_site_id = hcsu.cust_acct_site_id
and hcas.party_site_id = hpsu.party_site_id
and hpsu.site_use_type = 'CC_BILLING'
and creditcardeo.instrid = ipiu.instrument_id
and ipiu.instrument_type = 'CREDITCARD'
and creditcardeo.card_owner_id = hp.party_id
and hcsu.site_use_code = 'BILL_TO'
and hcsu.location = '36732870'--'36732870';
and creditcardeo.ccnumber like '%5615'
--and active_flag='Y'
hca.party_id,
hcas.party_site_id,
site_use_id,
hcsu.org_id,
hca.account_number,
hca.account_name,
hps.party_site_number,
location bill_location,
creditcardeo.card_issuer_code "CARD TYPE",
creditcardeo.ccnumber "CARD NUMBER",
chname,
trunc(ipiu.start_date) "VALID FROM",
trunc(creditcardeo.expirydate) "EXP DATE",
expired_flag,
active_flag,
hp.party_name "OWNER NAME",
hcsu.location,
hl.address1,
hl.address2,
hl.city,
hl.state,
hl.postal_code,
creditcardeo.description "CARDHOLDER NAME",
creditcardeo.invalidation_reason,
(select iss.segment_cipher_text
from apps.iby_fndcpt_tx_extensions extn,
iby.iby_security_segments iss
where extn.instr_assignment_id = ipiu.instrument_payment_use_id
and extn.instr_code_sec_segment_id = iss.sec_segment_id
and rownum = 1) cvv
from apps.hz_cust_accounts_all hca,
apps.hz_cust_acct_sites_all hcas,
apps.hz_cust_site_uses_all hcsu,
apps.hz_party_site_uses hpsu,
apps.iby_creditcard creditcardeo,
apps.iby_pmt_instr_uses_all ipiu,
apps.hz_parties hp,
hz_locations hl,
hz_party_sites hps
where hca.party_id = hp.party_id
and hps.party_site_id = hcas.party_site_id
and hps.location_id= hl.location_id
and hca.cust_account_id = hcas.cust_account_id
and hcas.cust_acct_site_id = hcsu.cust_acct_site_id
and hcas.party_site_id = hpsu.party_site_id
and hpsu.site_use_type = 'CC_BILLING'
and creditcardeo.instrid = ipiu.instrument_id
and ipiu.instrument_type = 'CREDITCARD'
and creditcardeo.card_owner_id = hp.party_id
and hcsu.site_use_code = 'BILL_TO'
and hcsu.location = '36732870'--'36732870';
and creditcardeo.ccnumber like '%5615'
--and active_flag='Y'
;
SELECT ipiu.instrument_payment_use_id,
ipiu.payment_flow,
ipiu.ext_pmt_party_id,
ipiu.instrument_type,
ipiu.instrument_id,
ic.ccnumber,
ic.card_issuer_code,
ipiu.payment_function,
DECODE (ipiu.order_of_preference,
1,
'Yes',
'NO'
) primary_flag,
ipiu.start_date,
ipiu.end_date,
ic.expirydate,
ipiu.debit_auth_flag,
ipiu.debit_auth_method,
ipiu.debit_auth_reference,
ipiu.debit_auth_begin,
ipiu.debit_auth_end
FROM iby_pmt_instr_uses_all ipiu,
iby_creditcard ic,
iby_external_payers_all iep
WHERE ipiu.instrument_id = ic.instrid
AND ipiu.ext_pmt_party_id = iep.ext_payer_id
AND iep.cust_account_id = 71950349
AND iep.acct_site_use_id = 36732870
;