SQLite Forum

Feature request: Stored Procedures
> For me the main benefit for UDF or Stored Procedure is the **parameterization**. If a view could be called with parameters, that would be almost what was in my mind from the beginning.

Actually, this I agree with, and is something I had wanted too. I would suggest extending the syntax for `CREATE VIEW` so that the list of column names can include type names and `DEFAULT` (and maybe also `COLLATE`); if the type name includes `HIDDEN` then it is a hidden column which can be constrained by table valued function syntax like virtual tables can.

However, it is then seems not possible to copy the value that is constrained, unless a virtual table extension is used to do that (and I don't know if that will work in a recursive CTE). Host parameter syntax could be another way, maybe.

> My implementation cannot **generate table results**, which a stored procedure (called with parameters) might be able to return. That's the main difference and where I see the benefit.

I believe you that the ability to generate table results can be useful. There is `RETURNING`, although it is limited:

* A view/triggers cannot specify what values are returned by `RETURNING`.

* You cannot use `RETURNING` anywhere that `SELECT` is allowed.