Oracle DELETE statement with subquery factoring

前端 未结 3 1775
一整个雨季
一整个雨季 2021-01-02 04:25

Trying to do this (works in SQL Server):

WITH X AS (), Y AS (), Z AS ()
DELETE FROM TBL
WHERE TBL.ID IN (SELECT ID FROM Z);

This works in O

3条回答
  •  既然无缘
    2021-01-02 04:54

    You cannot use Subquery Factoring/CTE with anything but the SELECT statement. From the documentation:

    You can specify this clause in any top-level SELECT statement and in most types of subqueries.

    You could do this:

    DELETE FROM tbl WHERE tbl.id IN
    (WITH X AS (), Y AS (), Z AS ()
    SELECT id FROM TBL
     WHERE TBL.ID IN (SELECT ID FROM Z));
    

提交回复
热议问题