Oracle
 sql >> Base de données >  >> RDS >> Oracle

Suppression dynamique dans Oracle

  delete departments

  where  department_id in
         (
            select department_id

            from  (    select  department_id, department_name, manager_id,location_id 
                       from    departments

                       minus

                       (          select 66,'Administration',200,1700 from dual
                       union all  select 77,'Marketing'     ,201,1800 from dual
                       )
                   )
         )

ou

  delete departments

  where  (department_id, department_name, manager_id,location_id) not in
         (          select 66,'Administration',200,1700 from dual
         union all  select 77,'Marketing'     ,201,1800 from dual
         )

Mais assurez-vous que vous n'avez pas select null,null,null,null from dual parmi vos enregistrements UNION ALL ou rien ne sera supprimé