SQLite Forum

How to write this trigger?
Login
>Note that you obviously cannot update the row you are inserting in a before insert trigger since the row has not yet been inserted.

Obviously.

I started out thinking in much less verbose solutions (and fewer execution steps) for such trivial data transformations that could be implemented in a `BEFORE` trigger as simply as:

`SELECT new.field := function(new.field)`

(not sure where/if I've seen this)

or

`SELECT function(new.field) INTO new.field`

(MySQL for @vars, not sure if it works in general for regular fields)

But neither syntax is supported by SQLite3.

Thanks again.  Your suggestion appears to work.