Advertisement
EddyCZ

Untitled

Apr 14th, 2023
1,526
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 1.67 KB | None | 0 0
  1.       SELECT --ITH.CONTRACT, --ITH.PART_NO,
  2.              ITH.LOCATION_NO, W.WAREHOUSE_ID,
  3.              W.LOCATION_GROUP, -- !!! used location_group from WAREHOUSE_BAY_BIN_TAB because in inventory_transaction_hist_tab.location_group is null for transaction from IFS 2003
  4.              SUM(DECODE(ITH.DIRECTION, '+', ITH.QUANTITY, '-', -ITH.QUANTITY, 0)) QTY,
  5.              SUM(SUM(DECODE(ITH.DIRECTION, '+', ITH.QUANTITY, '-', -ITH.QUANTITY, 0))) OVER() TOTAL_QTY,
  6.              --SUM(DECODE(ITH.DIRECTION, '+', ITH.QUANTITY, '-', -ITH.QUANTITY, 0)) /
  7.              --SUM(SUM(DECODE(ITH.DIRECTION, '+', ITH.QUANTITY, '-', -ITH.QUANTITY, 0))) OVER() WAVG,
  8.              ROW_NUMBER() OVER (ORDER BY ITH.location_no) rn,
  9.              COUNT(1) OVER() CNT
  10.         FROM INVENTORY_TRANSACTION_HIST_TAB ITH, WAREHOUSE_BAY_BIN_TAB W
  11.        WHERE ITH.CONTRACT = 'BO' AND ITH.PART_NO = '30.E1486-173' AND ITH.CONFIGURATION_ID = '*'
  12.          AND ITH.TRANSACTION_ID < 15030521
  13.          AND W.LOCATION_GROUP = 'TR02'
  14.          AND ITH.LOCATION_NO IS NOT NULL
  15.          AND ITH.LOCATION_NO = W.LOCATION_NO (+)
  16.          AND ITH.CONTRACT = W.CONTRACT (+)
  17.        --GROUP BY ROLLUP(ITH.LOCATION_NO)
  18.        GROUP BY ITH.LOCATION_NO, W.WAREHOUSE_ID, W.LOCATION_GROUP
  19.        
  20.        
  21.        SELECT ITH.DIRECTION,ITH.QUANTITY
  22.        FROM INVENTORY_TRANSACTION_HIST_TAB ITH, WAREHOUSE_BAY_BIN_TAB W
  23.        WHERE ITH.CONTRACT = 'BO' AND ITH.PART_NO = '30.E1486-173' AND ITH.CONFIGURATION_ID = '*'
  24.          AND ITH.TRANSACTION_ID < 15030521
  25.          AND W.LOCATION_GROUP = 'TR02'
  26.          AND ITH.LOCATION_NO IS NOT NULL
  27.          AND ITH.LOCATION_NO = W.LOCATION_NO (+)
  28.          AND ITH.CONTRACT = W.CONTRACT (+)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement