SQL
statements are classified as executable or non-executable.
An
executable statement can be invoked in four
ways. It can be:
- Issued interactively
- Prepared and executed dynamically
- Embedded in an application program
- Embedded
in an SQL procedure, trigger, compound SQL (compiled), or compound
SQL (inlined) with some restrictions:
- Refer to "SQL-procedure-statement" in Compound SQL (compiled) statement for
the set of executable statements supported in SQL procedures and compound
SQL (compiled) statements.
- Refer to "SQL-statement" in Compound SQL (inlined) statement statement
for the set of executable statements supported in compound SQL (inlined)
statements.
- Refer to "SQL-procedure-statement" in CREATE TRIGGER statement for
the set of executable statements supported in a trigger.
Depending on the statement, some or all of these methods can
be used. Statements embedded in REXX are prepared and executed dynamically.
A non-executable statement can only be embedded
in an application program.
Another SQL statement construct is the select-statement.
A
select-statement can be invoked in three ways. It can be:
- Issued interactively
- Prepared dynamically, referenced in DECLARE CURSOR, and executed
implicitly by OPEN, FETCH and CLOSE (dynamic invocation)
- Included in DECLARE CURSOR, and executed implicitly by OPEN, FETCH
and CLOSE (static invocation)