I'm trying to use DELETE FROM
with an IN
clause and a subquery to delete rows given by a query on another table that is 1-to-1 with the table I am deleting from, but Oracle 11g2 barfs an utterly unhelpful ORA-00900 error at me, as in the following SQL fiddle:
http://sqlfiddle.com/#!4/93171/1
For those who can't get at SQLfiddle, the schema/initial load I'm using is (I'm using varchar
instead of varchar2
for test portability, the "wild" data uses varchar2
instead):
create table obj (id integer primary key, data varchar(100));
create table meta(id integer primary key, imported char(1));
insert into obj (id, data) values (1, 'foo');
insert into obj (id, data) values (2, 'bar');
insert into obj (id, data) values (3, 'baz');
insert into obj (id, data) values (4, 'blurf');
insert into obj (id, data) values (5, 'hurf');
insert into meta (id, imported) values (1, 'T');
insert into meta (id, imported) values (2, 'F');
insert into meta (id, imported) values (3, 'T');
insert into meta (id, imported) values (4, 'F');
insert into meta (id, imported) values (5, 'F');
and the statements I'm trying to run are:
delete from obj where obj.id in (select meta.id from meta where meta.imported = 'F');
select * from obj full outer join meta on obj.id = meta.id;
(The select ... full outer join
runs by itself, and the error still happens if I still comment it out, so it's not the source of the ORA-00900.)
P.S. this statement is valid SQL, too -- neither SQL Server 2014 nor PostgreSQL 9.3 have an issue with the fiddle, and it works in a local copy of SQLite 3.8.8.3 as well once the full outer join
is switched for an inner join
.
This is indeed an issue in SQLFiddle -- the ORA-00900 does not occur when I run that form of delete statement against the actual database I'm working with.
Why the about page doesn't document this more clearly, I do not know...