advancedAdvanced SQL — Stored Procedures, Functions, Triggers & Sequences
Why can a stored procedure COMMIT but a function cannot?
Functions execute as part of the calling statement's transaction — they inherit it and cannot start or end one. Procedures are invoked via CALL as their own top-level statement, and are explicitly allowed to issue COMMIT/ROLLBACK inside their own body, useful for long-running batch work that needs incremental commits.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
Why can a stored procedure COMMIT but a function cannot?