SQLite Forum

RAISE(ROLLBACK,...) giving 'no transaction error'
Login
> There is no builtin SQL function that can tell you whether you are inside an explicit transaction

I guess there could be now, given the upcoming and unreleased
https://www.sqlite.org/draft/c3ref/txn_state.html API.