# Programmatic & Compound Statements

- [BEGIN END](/docs/server/reference/sql-statements/programmatic-compound-statements/begin-end.md): Group multiple SQL statements into a logical block. This construct defines a compound statement, creating a new scope for variables and exception handling.
- [CASE Statement](/docs/server/reference/sql-statements/programmatic-compound-statements/case-statement.md): Complete reference for CASE Statement in MariaDB. Complete syntax guide with all options, clauses, and practical examples with comprehensive examples and.
- [DECLARE CONDITION](/docs/server/reference/sql-statements/programmatic-compound-statements/declare-condition.md): Define named error conditions. This statement associates a name with a specific SQLSTATE or MariaDB error code for easier handling in stored programs.
- [DECLARE HANDLER](/docs/server/reference/sql-statements/programmatic-compound-statements/declare-handler.md): Specify actions for error conditions. This statement defines handler routines (CONTINUE or EXIT) to manage exceptions or warnings within a block.
- [DECLARE TYPE](/docs/server/reference/sql-statements/programmatic-compound-statements/declare-type.md): Define data types for Oracle compatibility. This statement allows declaring PL/SQL-style record types and associative arrays within stored procedures.
- [DECLARE Variable](/docs/server/reference/sql-statements/programmatic-compound-statements/declare-variable.md): Initialize local variables within a stored program. This statement defines variables with a specific data type and optional default value.
- [FOR](/docs/server/reference/sql-statements/programmatic-compound-statements/for.md): Loop through a range or cursor result set. This control flow statement repeatedly executes a block of code for each item in a specified range or query.
- [GOTO](/docs/server/reference/sql-statements/programmatic-compound-statements/goto.md): Jump to a labeled point in the code. This Oracle-compatible statement transfers execution control to a specific label within the stored program.
- [IF](/docs/server/reference/sql-statements/programmatic-compound-statements/if.md): Execute code based on conditions. This control flow statement runs different blocks of SQL statements depending on whether a specified condition is true.
- [ITERATE](/docs/server/reference/sql-statements/programmatic-compound-statements/iterate.md): Restart the current loop. This statement jumps back to the beginning of a LOOP, REPEAT, or WHILE block, skipping any remaining statements in the current iteration.
- [Labels](/docs/server/reference/sql-statements/programmatic-compound-statements/labels.md): Identify blocks and loops for flow control. Labels provide names for BEGIN...END blocks or loops, allowing them to be targeted by LEAVE, ITERATE, or GOTO statements.
- [LEAVE](/docs/server/reference/sql-statements/programmatic-compound-statements/leave.md): Exit a labeled block or loop immediately. This statement terminates the execution of the current loop or compound statement and continues after the block.
- [LOOP](/docs/server/reference/sql-statements/programmatic-compound-statements/loop.md): Create a simple loop construct. This statement repeatedly executes a block of code until explicitly terminated by a LEAVE statement.
- [REPEAT LOOP](/docs/server/reference/sql-statements/programmatic-compound-statements/repeat-loop.md): Execute a block until a condition is met. This loop construct runs at least once and continues repeating as long as the UNTIL condition remains false.
- [RESIGNAL](/docs/server/reference/sql-statements/programmatic-compound-statements/resignal.md): Propagate error conditions. This statement allows a handler to pass an error condition back to the caller or modify the error information before passing it on.
- [RETURN](/docs/server/reference/sql-statements/programmatic-compound-statements/return.md): Exit a stored function and return a value. This statement terminates function execution and sends the specified result back to the caller.
- [SELECT INTO](/docs/server/reference/sql-statements/programmatic-compound-statements/selectinto.md): Assign query results to variables. This statement retrieves column values from a single row and stores them in local variables or user-defined variables.
- [SIGNAL](/docs/server/reference/sql-statements/programmatic-compound-statements/signal.md): Raise a custom error condition. This statement allows stored programs to generate specific error messages and SQLSTATEs to handle application logic exceptions.
- [WHILE](/docs/server/reference/sql-statements/programmatic-compound-statements/while.md): Execute a block while a condition is true. This loop construct checks a condition before each iteration and repeats the block as long as the condition holds.
- [Using Compound Statements Outside of Stored Programs](/docs/server/reference/sql-statements/programmatic-compound-statements/using-compound-statements-outside-of-stored-programs.md)
- [Cursors](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors.md): Learn about cursors in MariaDB Server's programmatic compound statements. This section details how to iterate over result sets row-by-row within stored procedures and functions.
- [Cursor Overview](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/cursor-overview.md)
- [CLOSE](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/close.md)
- [DECLARE CURSOR](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/declare-cursor.md)
- [FETCH](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/fetch.md)
- [OPEN](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/open.md)
- [Diagnostics](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics.md): Learn about diagnostics in programmatic compound statements. This section covers error handling and information retrieval within stored procedures and functions for effective debugging.
- [Diagnostics Area](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/diagnostics-area.md)
- [GET DIAGNOSTICS](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/get-diagnostics.md)
- [SQLSTATE](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-diagnostics/sqlstate.md)
