Hi,
How can I avoid this error in the following select statement...?
Thank you
A/A
SELECT DISTINCT
DECODE (hcsua.site_use_code, 'SHIP_TO', hcsua.location)
"Customer Ship-To Code",
DECODE (hcsua.site_use_code,
'BILL_TO', hcsua.location,
'SHIP_TO', hca.account_number)
"Customer Bill-To Code",
hp.party_name "Customer Name",
DECODE (
hcsua.site_use_code,
'SHIP_TO', hl.address1
|| ' '
|| hl.address2
|| ' '
|| hl.city
|| ' '
|| hl.State
|| ' '
|| hl.Country
|| ' '
|| hl.postal_code)
"Ship-TO Address",
(SELECT hl.address1 "Bill-To Addess"
FROM hz_cust_acct_sites_all hcsa,
hz_party_sites hps,
hz_cust_site_uses_all hcsua,
hz_cust_accounts hca,
hz_parties hp,
hz_locations hl
WHERE hps.party_site_id = hcsa.party_site_id
AND hcsa.cust_acct_site_id = hcsua.cust_acct_site_id
AND hca.cust_account_id = hcsa.cust_account_id
AND hp.party_id = hca.party_id
AND hl.location_id = hps.location_id
AND hcsua.site_use_code = 'BILL_TO')
-- AND HP.PARTY_ID = '1524')
FROM hz_cust_acct_sites_all hcsa,
hz_party_sites hps,
hz_cust_site_uses_all hcsua,
hz_cust_accounts hca,
hz_parties hp,
hz_locations hl
WHERE hps.party_site_id = hcsa.party_site_id
AND hcsa.cust_acct_site_id = hcsua.cust_acct_site_id
AND hca.cust_account_id = hcsa.cust_account_id
AND hp.party_id = hca.party_id
AND hl.location_id = hps.location_id
-- AND HP.PARTY_ID = '1524'