LEAVE

The LEAVE statement is used in SQL Script to abort execution of the current block.

Syntax

LEAVE <label>

Remark

The LEAVE statement is equivalent to using break in Java. It aborts the current loop or compound statement block, without throwing an error.

Example

--Pads s with padChar so that s has at least width length.
PROCEDURE padr (IN s VARCHAR, IN width INTEGER, IN padChar VARCHAR, OUT result VARCHAR)
L-padr:
BEGIN
  --Returns null if any parameter is null
  IF s IS NULL OR width IS NULL OR padChar IS NULL THEN
    LEAVE L-padr;
  END IF;
...
END