我在访问中创建了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));
STOCK_LEVELS表格列:
EXTRACT_WORK_001_GROWTH表格列:
答案 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;