Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ora-01427 single row subuery returns more than one row.

379746Aug 12 2010 — edited Aug 13 2010
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'
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2010
Added on Aug 12 2010
15 comments
2,837 views