SQL routine implementation
A SQL routine implementation is composed entirely of SQL statements.
SQL routine implementations are characterized by the fact that the SQL statements that define the logic of the routines are included within the CREATE statement used to create the routine in the database. SQL routines are quick and easy to implement because of their simple syntax, and perform well due to their close relationship with the database manager.
The SQL Procedural Language (SQL PL) is a language extension of basic SQL that consists of statements and language elements that can be used to implement programming logic in SQL. SQL PL includes a set of statements for declaring variables and condition handlers (DECLARE statement) assigning values to variables (assignment-statement), and for implementing procedural logic (control-statements) such as IF, WHILE, FOR, GOTO, LOOP, SIGNAL, and others. SQL and SQL PL can be used to create SQL procedures, functions, triggers, and compound SQL statements. SQL procedures and functions, along with SQL global variables, user-defined conditions, and data-types, can be grouped together in modules.