SQLite Forum

Feature request: Stored Procedures
Login
You would have separate `INSTEAD OF` triggers on

 - `INSERT`
 - `UPDATE`
 - `DELETE`

Any trigger can do `INSERT`, `UPDATE` or `DELETE` on any table in the statements between `BEGIN` and `END`.

Triggers can do `SELECT`s where needed to make decisions of what values to use for `INSERT`, `UPDATE` or `DELETE`. 

You can even use multiple `INSERT/UPDATE/DELETE` triggers with different `WHEN` clauses to discriminate between cases.

I would implement a "SELECT in a trigger" as a view. No need for a trigger.