Hi folks!
After having UPDATE and INSERT on a view working, I'd also like to DELETE
FROM a view. I have the following tables and a view:
---
create table dbapp_tablenames (
tablenameID integer primary key,
tablename text not null unique on conflict ignore
);
create table dbapp_tablefields (
tablenameID integer not null,
tablefield text not null
);
create view dbapp as
select tablename,group_concat(tablefield) as fields
from dbapp_tablefields as fs join dbapp_tablenames as ts
on (ts.tablenameID=fs.tablenameID) group by ts.tablenameID;
create trigger dbapp_delete instead of delete on dbapp begin
delete from dbapp_tablefields where tablenameID=(
select tablenameID from dbapp_tablenames
where tablename=old.tablename
and tablefield=old.tablefield);
select case when ((
select tablefield from dbapp_tablefields f
join dbapp_tablenames t on (f.tablenameID=t.tablenameID)
where tablefield=old.fields and tablname=old.tablename) is null)
then (delete from dbapp_tablenames where tablename=old.tablename)
end;
end;
---
But the trigger produces a syntax error at "delete" in the first line.
What's wrong?
Greetings,
Fabiano
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users