このクエリを実行しようとしていますが、どういうわけか下部のラベル B が機能しません。
私はオラクルが初めてで、何が問題なのかわかりません。誰でも私を助けてくれますか? それは大歓迎です。
営業担当者が関連付けられていない場合、データは返されません。これは、基本顧客に関する情報を返す必要があります。
SELECT DISTINCT X.ship_sales_representative_id,
X.ship_sales_representative_name,
X.ship_sales_regional_name,
X.ship_sales_regional_head,
B.bl_customer_representative_id,
X.sp_customer_representative_id,
B.bill_customer_id,
X.ship_customer_id,
B.bill_customer_address_suffix,
X.ship_customer_address_suffix,
B.bill_customer_name,
X.ship_customer_name,
B.bill_customer_address,
X.ship_customer_address,
B.bill_customer_city,
X.ship_customer_city,
B.bill_customer_statecode,
X.ship_customer_statecode,
B.bill_customer_zipcode,
X.ship_customer_zipcode,
B.bill_customer_phonenumber,
X.ship_customer_phonenumber,
B.bill_customer_faxnumber,
X.ship_customer_faxnumber,
B.bill_customer_email,
X.ship_customer_email,
B.bill_customer_contact,
X.ship_customer_contact
FROM (SELECT DISTINCT S.rep_id Ship_Sales_Representative_ID,
S.rep_name Ship_Sales_Representative_Name,
S.reg_name Ship_Sales_Regional_Name,
S.reg_head Ship_Sales_Regional_Head,
C.rep_id Sp_Customer_Representative_ID,
C.cust_id Ship_Customer_ID,
C.addr_suffix Ship_Customer_Address_Suffix,
C.name Ship_Customer_Name,
C.addr_ln_1 Ship_Customer_Address,
C.city Ship_Customer_City,
C.state_cd Ship_Customer_StateCode,
C.zip_cd Ship_Customer_Zipcode,
C.phone_nbr Ship_Customer_PhoneNumber,
C.fax_nbr Ship_Customer_FaxNumber,
C.email Ship_Customer_Email,
C.contact Ship_Customer_Contact
FROM mdw.customer C,
mdw.sales_org S
WHERE C.rep_id = To_char(S.rep_id, 'FM000000')
AND C.cust_id = v_cust_id
AND C.addr_suffix = v_addr_suffix) X,
(SELECT DISTINCT C.rep_id Bl_Customer_Representative_ID,
C.cust_id Bill_Customer_ID,
C.addr_suffix Bill_Customer_Address_Suffix,
C.name Bill_Customer_Name,
C.addr_ln_1 Bill_Customer_Address,
C.city Bill_Customer_City,
C.state_cd Bill_Customer_StateCode,
C.zip_cd Bill_Customer_Zipcode,
C.phone_nbr Bill_Customer_PhoneNumber,
C.fax_nbr Bill_Customer_FaxNumber,
C.email Bill_Customer_Email,
C.contact Bill_Customer_Contact
FROM mdw.customer C
WHERE C.cust_id = v_cust_id
AND C.addr_suffix = '0001') B;