On Sat, Jan 08, 2011 at 01:29:23AM +0000, Simon Slavin wrote: > On 8 Jan 2011, at 1:12am, Nicolas Williams wrote: > > I need to use recursive triggers. In some cases I want to "normalize" > > values of some columns of NEW being INSERTed or UPDATEd, but there's no > > UPDATE syntax for changing NEW, thus I can't write something like: > > > CREATE TRIGGER fred INSTEAD OF INSERT ON myTable ...
Oh, for some reason I thought that INSTEAD OF triggers were for views only, but that's not the case. Yes, I see now that to change NEW I can just use INSTEAD OF triggers: CREATE TRIGGER foo_trig INSTEAD OF INSERT ON foo BEGIN INSERT INTO bar (some_col) SELECT <expr normalizing NEW.some_col>; END; Handy. Thanks! The insert in the trigger body surely has to be on a different table than the trigger is for, else the instead-of trigger will recurse, right? So I still need a table or view for the application to use as a stand-in for the actual table. Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users