Oracle 10g multiple DELETE statements
Posted
by
bmw0128
on Stack Overflow
See other posts from Stack Overflow
or by bmw0128
Published on 2011-02-10T18:13:45Z
Indexed on
2011/02/10
23:25 UTC
Read the original article
Hit count: 182
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.
© Stack Overflow or respective owner