On 19 May 2011 07:16, Support Lists <supportli...@qlands.com> wrote: > Hi, > > I have the following sqlite trigger: > / > /|/CREATE TRIGGER DLT_actymethods_ibfk_1 BEFORE DELETE ON activity FOR > EACH ROW BEGIN DELETE FROM actymethods WHERE ACTY_COD = OLD.ACTY_COD; END/ > > |So before delete the row from the table activity delete all records > from the table actymethods associated to that activity. > > The problem is that I get the error: > > /"Only a single result allowed for a SELECT that is part of an expression"/ > > Any idea why? And how to solve it?
Here's what I tried: SQLite version 3.6.23.1 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table tmp( id integer primary key, id1 integer, data text ); sqlite> insert into tmp values( 1, 2, '2_1' ); sqlite> insert into tmp values( 2, 5, '5_1' ); sqlite> insert into tmp values( 3, 2, '2_2' ); sqlite> insert into tmp values( 4, 3, '3_1' ); sqlite> insert into tmp values( 5, 2, '2_3' ); sqlite> insert into tmp values( 6, 3, '3_2' ); sqlite> insert into tmp values( 7, 2, '2_4' ); sqlite> sqlite> create trigger tmp_delete before delete on tmp begin delete from tmp where id1 = old.id1; end; sqlite> sqlite> select * from tmp; 1|2|2_1 2|5|5_1 3|2|2_2 4|3|3_1 5|2|2_3 6|3|3_2 7|2|2_4 sqlite> delete from tmp where id=7; sqlite> sqlite> select * from tmp; 2|5|5_1 4|3|3_1 6|3|3_2 sqlite> No error. > > Many thanks. > Carlos. Regards, Simon _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users