SQLite was a library for TCL, implementing "sqlite" command, and from TCL one can use it in a variety of interesting ways, approaching and even surpassing "stored procedures" concept.

For example, it is easy to create SQL function using TCL: https://sqlite.org/tclsqlite.html#the_function_method