我无法获取正确的值(EBS ORACLE)-地址

时间:2019-03-10 17:26:38

标签: sql oracle11g oracle-ebs

我一直在尝试获取正确的值(而不是id一)成功

看一下:每当我执行查询以获取特定帐户(SHIP_TO,BILL_TO和其他地址)的 ALL 地址时,我都会得到这些列(请注意,我不能尚未上传图片)

image

这是我的查询

SELECT
 hca.account_number Client_account_number
,'Contact' firstname
,Hp.Party_Name  lastname
, hl.address1 Street
, 0  StreetNumber
,hl.country Country_ID
, hl.city City
, (Select Geography_Name From Hz_Geographies
   Where Geography_Type = 'PROVINCE'
   And Geography_Code = hl.province) Region
, hl.postal_code postcode
 , CASE   
     WHEN Primary_Phone_Area_Code IS NULL  THEN NULL
      ELSE
        Hp.Primary_Phone_Country_Code || ' - ' || Primary_Phone_Area_Code || ' - ' || Primary_Phone_Number
     END telephone
,'2' Type_Id
,SUBSTR(Hcsa.Orig_System_Reference,4,20) orig_system_ref
,Hcsa.Orig_System_Reference
,hl.location_id
FROM hz_parties hp
, hz_party_sites hps
, hz_locations hl
, hz_cust_accounts_all hca
, hz_cust_acct_sites_all hcsa
, hz_cust_site_uses_all hcsu
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hp.party_id = hca.party_id
AND hcsa.party_site_id = hps.party_site_id
AND hcsu.cust_acct_site_id = hcsa.cust_acct_site_id
AND hca.cust_account_id = hcsa.cust_account_id
AND hca.account_number in ('account_number')
AND NVL (hcsu.status, 'A') = 'A'
AND hp.status = 'A'
AND hcsa.status = 'A'
order by orig_system_ref
;  

最后一列返回的是“原始”值的ID,而不是正确的ID。

您能帮我了解这里发生了什么吗?我该如何修改查询以获得我想要的值?

PS:我正在连接到Oracle数据库(11g)

0 个答案:

没有答案