Oracle 10g multiple DELETE statements
- by bmw0128
I'm building a dml file that first deletes records that may be in the table, then inserts records.
Example:
DELETE from foo where field1='bar';
DELETE from foo where fields1='bazz';
INSERT ALL
INTO foo(field1, field2) values ('bar', 'x')
INTO foo(field1, field2) values ('bazz', 'y')
SELECT * from DUAL;
When I run the insert statement by itself, it runs fine. When I run the deletes, only the last delete runs.
Also, it seems to be necessary to end the multiple insert with the select, is that so? If so, why is that necessary?
In the past, when using MySQL, I could just list multiple delete and insert statements, all individually ending with a semicolon, and it would run fine.