长查询错误

时间:2017-06-28 13:44:42

标签: sql oracle

我刚刚在工作中写了一个查询,但我得到了" ORA-00920:无效的关系运算符"在运行它时,我似乎无法找到我的错误。

所以这里是:

SELECT  
  D.DEPARTURE_NO,  
  D.DEPARTURE_DATE,  
  I.ITEM_GROUP_ID,  
  L.LUID,  
  OA.ADDRESS1,  
  OA.ADDRESS2,  
  OA.CITY,  
  OA.COUNTRY_CODE,  
  OA.NAME,  
  OA.POSTAL_CODE,  
  OA.RECEIVER_ID,  
  OC.COUNTRY_NAME,  
  OL.ORDER_LINE_NO,  
  O.INTERNAL_ORDER_ID,  
  O.RECEIVER_ORDER_ID,  
  O.STORER_ID,  
  O.STORER_ORDER_ID,  
  PL.BIN_LOCATION_ID,  
  PLL.PICK_STATUS,  
  PLL.PICKLIST_LINE_NO,  
  S.SHIPMENT_ID,  
  SH.NAME,  
  SH.SHIPPER_ID,  
  SS.SHIPPER_SERVICES_ID,  
  ST.NAME,  
  SA.ADDRESS_TYPE,  
  SA.ADDRESS1,  
  SA.ADDRESS2,  
  SA.ADDRESS3,  
  SA.CITY,  
  SA.POSTAL_CODE,  
  SC.COUNTRY_NAME,  
  VOPI.PARENT_INTERNAL_ORDER_ID  
FROM  
  ORDERS O  
INNER JOIN VY_ORDER_PARENT_ID VOPI ON VOPI.INTERNAL_ORDER_ID = O.INTERNAL_ORDER_ID  
INNER JOIN VY_ORDER_PARENT_ID VOPI ON VOPI.INTERNAL_ORDER_ID = OA.INTERNAL_ORDER_ID  
INNER JOIN ORDER_ADDRESS OA ON OA.INTERNAL_ORDER_ID = O.INTERNAL_ORDER_ID  
INNER JOIN SHIPMENT S ON S.SHIPMENT_ID = O.SHIPMENT_ID  
INNER JOIN SHIPPER_SERVICES SS ON SS.SHIPPER_SERVICES_NO = O.SHIPPER_SERVICES_NO 
INNER JOIN STORER ST ON ST.STORER_ID = O.STORER_ID  
INNER JOIN ORDER_LINE OL ON OL.INTERNAL_ORDER_ID = O.INTERNAL_ORDER_ID  
INNER JOIN SHIPPER SH ON SH.SHIPPER_ID = O.SHIPPER_ID  
INNER JOIN ORDER_COUNTRY OC ON OC.COUNTRY_CODE = OA.COUNTRY_CODE  
INNER JOIN STORER_COUNTRY SC ON SC.COUNTRY_CODE OA.COUNTRY_CODE  
INNER JOIN STORER_ADDRESS SA ON SA.COUNTRY_CODE = SC.STORER_ADDRESS  
INNER JOIN STORER ST ON ST.STORER_ID = SA.STORER_ID  
INNER JOIN DEPARTURE D ON D.ACTIVE_TRANSPORT_COUNTRY = SC.COUNTRY_CODE  
INNER JOIN DEPARTURE D ON D.DEPARTURE_NO = S.DEPARTURE_NO  
INNER JOIN ITEM I ON I.COUNTRY_CODE = SC.COUNTRY_CODE  
INNER JOIN SHIPPER SH ON SH.SHIPPER_ID = S.SHIPPER_ID  
INNER JOIN SHIPPER_SERVICES SS ON SS.SHIPPER_SERVICES_NO = S.SHIPPER_SERVICES_NO  
INNER JOIN SHIPPER SH ON SH.SHIPPER_ID = SS.SHIPPER_ID  
INNER JOIN IC_TRANSACTION ICT ON ICT.LUID_NO = L.LUID_NO  
INNER JOIN PICKLIST_LINE PLL ON PLL.IC_TRANSACTION_NO = ICT.IC_TRANSACTION_NO  
INNER JOIN LUID L ON L.STORER_ID = ST.STORER_ID   
INNER JOIN ITEM I ON I.STORER_ID = ST.STORER_ID  
INNER JOIN ITEM I ON I.ITEM_ID = OL.ITEM_ID AND I.STORER_ID = OL.ITEM_ID  
INNER JOIN PICK_LOCATION PL ON PL.ITEM_ID = I.ITEM_ID AND PL.STORER_ID = I.ITEM_ID  
INNER JOIN PICKLIST_LINE PLL ON PLL.EXPECTED_BIN_LOCATION_ID = PL.BIN_LOCATION_ID  
INNER JOIN PICKLIST_LINE PLL ON PLL.EXPECTED_BUILDING_ID = PL.BUILDING_ID  
INNER JOIN ORDER_LINE OL ON OL.INTERNAL_ORDER_ID = PLL.INTERNAL_ORDER_ID AND OL.ORDER_LINE_NO = PLL.ORDER_LINE_NO  

   WHERE S.SHIPMENT_ID = '2000518517'  

显然,您无法知道确切的列名,但我已多次浏览它们,并且无法找到任何拼写错误。

任何其他错误

1 个答案:

答案 0 :(得分:3)

INNER JOIN STORER_COUNTRY SC ON SC.COUNTRY_CODE OA.COUNTRY_CODE 

应该是

INNER JOIN STORER_COUNTRY SC ON SC.COUNTRY_CODE = OA.COUNTRY_CODE 

看起来像

INNER JOIN ORDER_LINE OL ON OL.INTERNAL_ORDER_ID = PLL.INTERNAL_ORDER_ID AND OL.ORDER_LINE NO = PLL.ORDER_LINE_NO

应该(感谢LONG)

INNER JOIN ORDER_LINE OL ON OL.INTERNAL_ORDER_ID = PLL.INTERNAL_ORDER_ID AND OL.ORDER_LINE_NO = PLL.ORDER_LINE_NO