ms-访问oracle转换

时间:2014-08-26 04:03:25

标签: sql oracle ms-access

我在访问中创建了98个不同的查询(其中两个我无法工作),并且需要转换为Oracle ...请帮助。

  UPDATE STOCK_LEVELS
  SET
    (
      STK_LEVEL,TOTAL_PALLETS_RQD
    )
    =
    (
      SELECT (STOCKING_LEVEL, TRUNC((STOCK_LEVELS.STK_LEVEL / CASES_PER_PALLET) + 0.9))
      FROM (STOCK_LEVELS
      INNER JOIN EXTRACT_WORK_001_GROWTH
      ON STOCK_LEVELS.LOC_ID             = EXTRACT_WORK_001_GROWTH.LOC_ID
      AND STOCK_LEVELS.INVEN_ID          = EXTRACT_WORK_001_GROWTH.INVEN_ID
      AND STOCK_LEVELS.FSCL_YR_NUM       = EXTRACT_WORK_001_GROWTH.FSCL_YR_NUM
      AND STOCK_LEVELS.FSCL_WK_IN_YR_NUM = EXTRACT_WORK_001_GROWTH.FSCL_WK_IN_YR_NUM));
  1. STOCK_LEVELS表格列:

    • LOC_ID
    • INVEN_ID
    • FSCL_YR_NUM
    • FSCL_WK_IN_YR_NUM
    • STK_LEVEL
  2. EXTRACT_WORK_001_GROWTH表格列:

    • LOC_ID
    • INVEN_ID
    • FSCL_YR_NUM
    • FSCL_WK_IN_YR_NUM
    • ADJUSTED_BAY_USPD
    • ADJUSTED_BULK_USPD
    • ADJUSTED_COMBINED_USPD
    • BAY_FULL_PALLETS
    • BULK_FULL_PALLETS
    • COMBINED_FULL_PALLETS
    • BAY_QTY
    • BULK_QTY
    • COMBINED_QTY
    • BAY_ACTIVITY
    • BULK_ACTIVITY
    • BAY_CASEFLOW_SKU_COUNT
    • BULK_CASEFLOW_SKU_COUNT
    • COMBINED_CASEFLOW_SKU_COUNT
    • DAY_COUNT
    • BULK_PICK_PALLETS_RQD
    • CASES_PER_PALLET
    • BAY_PICK_PALLETS_RQD
    • COMBINED_PICK_PALLETS_RQD
    • TOTAL_PALLETS_RQD
    • COMBINED_PALLET_RESERVE_RQD
    • STOCKING_LEVEL
    • SEPARATE_PALLET_RESERVE_RQD
    • BULK_PICK_FLOOR_POSITIONS
    • BAY_PICK_FLOOR_POSITIONS
    • COMBINED_PICK_FLOOR_POSITIONS
    • STACK_HEIGHT

1 个答案:

答案 0 :(得分:0)

使用MERGE:

  MERGE INTO STOCK_LEVELS
  USING
  (
      SELECT STOCKING_LEVEL, TRUNC((STOCK_LEVELS.STK_LEVEL / CASES_PER_PALLET) + 0.9) TPR,
      STOCK_LEVELS.ROWID r
      FROM STOCK_LEVELS
      INNER JOIN EXTRACT_WORK_001_GROWTH
      ON STOCK_LEVELS.LOC_ID             = EXTRACT_WORK_001_GROWTH.LOC_ID
      AND STOCK_LEVELS.INVEN_ID          = EXTRACT_WORK_001_GROWTH.INVEN_ID
      AND STOCK_LEVELS.FSCL_YR_NUM       = EXTRACT_WORK_001_GROWTH.FSCL_YR_NUM
      AND STOCK_LEVELS.FSCL_WK_IN_YR_NUM = EXTRACT_WORK_001_GROWTH.FSCL_WK_IN_YR_NUM  )
  ON (ROWID = r)
  WHEN MATCHED THEN UPDATE
  SET STK_LEVEL = STOCKING_LEVEL, TOTAL_PALLETS_RQD = TPR;