Dynamic Delete In Oracle
I have Some static data for that i am creating select statement with the help of union all and i am comparing those data with DB table (departments).. with the help of minus i will
Solution 1:
delete departments
where department_id in
(
select department_id
from ( select department_id, department_name, manager_id,location_id
from departments
minus
( select66,'Administration',200,1700from dual
unionallselect77,'Marketing' ,201,1800from dual
)
)
)
or
delete departments
where (department_id, department_name, manager_id,location_id) notin
( select66,'Administration',200,1700from dual
unionallselect77,'Marketing' ,201,1800from dual
)
But make sure you don't have select null,null,null,null from dual among your UNION ALL records or nothing will be deleted
Post a Comment for "Dynamic Delete In Oracle"