Hi Igor I'm converting an Interbase DB for use in a smaller application, so there are many different examples.
I've included one particular example below, where I have converted a single Interbase trigger (which used IF statements), into 4 separate SQLite triggers. Any advice appreciated.Russell. /* Trigger: TEXTLISTS_B4DEL */ CREATE TRIGGER TEXTLISTS_B4DEL_genericsinfo BEFORE DELETE ON TEXTLISTS when (old.listtype in ('W', 'C')) and (select TextList_id from genericsinfo where TextList_id = old.textlist_id Limit 1) is not null begin Select Raise(Fail, 'DEPENDANCYERROR'); end; /* Trigger: TEXTLISTS_B4DEL */ CREATE TRIGGER TEXTLISTS_B4DEL_PRODLOCATION BEFORE DELETE ON TEXTLISTS when (old.listtype = 'L') and (select PRODUCT_ID from PRODUCTS where LOCATION = old.identifier Limit 1) is not null begin Select Raise(Fail, 'DEPENDANCYERROR'); end; /* Trigger: TEXTLISTS_B4DEL */ CREATE TRIGGER TEXTLISTS_B4DEL_PRODTYPE BEFORE DELETE ON TEXTLISTS when (old.listtype = 'PT') and (select PRODUCT_ID from PRODUCTS where PRODTYPE = old.identifier Limit 1) is not null begin Select Raise(Fail, 'DEPENDANCYERROR'); end; /* Trigger: TEXTLISTS_B4DEL */ CREATE TRIGGER TEXTLISTS_B4DEL_PRODFORM BEFORE DELETE ON TEXTLISTS when (old.listtype = 'PF') and (select PRODUCT_ID from PRODUCTS where PROD_FORM = old.identifier Limit 1) is not null begin Select Raise(Fail, 'DEPENDANCYERROR'); end; --- On Sat, 9/10/10, Igor Tandetnik <itandet...@mvps.org> wrote: From: Igor Tandetnik <itandet...@mvps.org> Subject: Re: [sqlite] Confitional IF in triggers To: sqlite-users@sqlite.org Received: Saturday, 9 October, 2010, 12:21 AM Russell A <slurc...@yahoo.com.au> wrote: > This may be a really dumb question, but I've searched and can't find an > answer. > Do SQLite triggers support any conditional expressions, like IF, or is there > only the WHEN statement? If the latter, does that > mean that multiple conditions must be in separate triggers? Any help > appreciated.Stopgap. What kind of conditions do you have in mind? Could you give an example? There is no IF statement in SQLite, but one can get creative with the WHEN clause on the trigger itself, and the WHERE clauses of individual statements within the trigger. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users