When I run a DELETE command in Oracle, it does all of the should-I-delete-this-row evaluation before it performs any deletion, right? That's well-defined Oracle behavior, right?
For example, if I have a table ATABLE with numeric ID and alphanumeric VALUE columns, and three rows with different IDs but all the same VALUE, and I run this command ...
delete from ATABLE A1
where exists (select * from ATABLE A2
where A1.VALUE = A2.VALUE and A1.ID <> A2.ID);
... then it deletes all three rows. To me that indicates evaluate-evaluate-evaluate, delete-delete-delete. If it were evaluate-delete, evaluate-delete, evaluate-delete, then there would be one row remaining at the end, because it would have no row to match with.
Again, just checking that the theory matches the practice here. Thank you.
Yes, but you can test that yourself:
Then the table contains:
If you run your
DELETEquery then, after theDELETEthe table will contain:All the duplicate
VALUErows are deleted.fiddle