END is a reserved word used to close several kinds of compound statements in SQL. Most commonly it pairs with BEGIN to wrap multiple SQL commands inside stored procedures, triggers, functions, or anonymous code blocks. It also terminates CASE expressions and various control-flow constructs in procedural dialects (IF...END IF, LOOP...END LOOP, WHILE...END WHILE, etc.). The presence of END signals to the parser that the preceding block is complete so execution can proceed. END itself performs no action; its role is purely syntactic. Some dialects require a delimiter (semicolon or slash) after END, and PL/SQL often appends the object name (END procedure_name;) for clarity. Failing to include END where required results in compilation errors such as "missing END" or "syntax error at end of input".
BEGIN, CASE, IF, LOOP, WHILE, COMMIT, ROLLBACK
SQL-92 standard
END typically pairs with BEGIN, CASE, IF, LOOP, WHILE, and other control-flow starters to close the construct.
No. END is purely syntactic and produces no rows or messages by itself.
This usually means the parser reached the end of your code without finding the expected END to close a BEGIN or CASE.
Yes. Multiple BEGIN...END blocks can be nested. Each BEGIN must have its own corresponding END.