Search code examples
sqloracle-sqldeveloperoracle-apexoracle-apex-5oracle-apex-5.1

ORACLE APEX Deleting rows with LEFT JOIN


I am getting this error when i try to delete the records of the first table, where the ID of this table does not exist in the records of the second table?

delete APP_LOG 
from APP_LOG
left join APP_AUDIT on APP_LOG.ID = APP_AUDIT.LOG_ID
where APP_AUDIT.ID is null

enter image description here


Solution

  • This syntax is not supported by Oracle.
    You can do it with NOT EXISTS:

    DELETE FROM APP_LOG al
    WHERE NOT EXISTS (
      SELECT 1 
      FROM APP_AUDIT aa
      WHERE al.ID = aa.LOG_ID
    )