WITH
block before the query:
.
characters.
The routine declaration is only valid within the context of the query. A
separate later invocation of the routine is not possible. If this is desired,
use a catalog routine.
Multiple inline routine declarations are comma-separated, and can include
routines calling each other, as long as a called routine is declared before
the first invocation.
example.default.power
for the power
routine
in the default
schema of the example
catalog.
Invocation must use the fully qualified name, such as example.default.power
.
CASE
IF
LOOP
REPEAT
WHILE
ITERATE
statement or exit the block with the LEAVE
statement. This flow control is
supported for nested blocks, allowing to continue or exit an outer block, not
just the innermost block. For example, the following snippet uses the label
top
to name the complete block from REPEAT
to END REPEAT
:
ITERATE
and LEAVE
statements to continue
processing the block or leave the block. This flow control is also supported for
nested blocks and labels.
RETURNS NULL ON NULL INPUT
characteristics
unless the code has some special handling for null values. You must declare
this explicitly since CALLED ON NULL INPUT
is the default characteristic.SELECT
queries to retrieve
data or any other queries to process data within the routine. Instead queries
can use routines to process data. Routines only work on data provided as input
values and only provide output data from the RETURN
statement.