我得到一個錯誤獲取ORA-00928:缺少SELECT關鍵字錯誤
ORA-00928:在運行該查詢缺少SELECT關鍵字
:
WITH Dups AS
(
SELECT
ID, AMOUNT, BATCH_ID, PROCESS_DATE, ITEM_NUMBER, ERROR_TYPE, INSERTED_DATE,
ROW_NUMBER() OVER(PARTITION BY ID, ERROR_TYPE ORDER BY ID) AS rn
FROM
ERROR_TABLE
WHERE
inserted_date >= TRIM(TO_DATE('01-AUG-17', 'DD-MON-YY'))
AND inserted_date <= TRIM(TO_DATE('11-AUG-17', 'DD-MON-YY'))
)
DELETE FROM Dups
WHERE rn > 1
你不能從一個CTE刪除行,所以他們必須跟一個選擇。也許你想把這個包裝在一個子查詢和你的RN> 1條件 – markg