Firebird Documentation IndexFirebird 1.5 Language Ref. UpdatePSQL statements → LEAVE
Firebird Home Firebird Home Prev: FOR SELECT ... INTO ... DOFirebird Documentation IndexUp: PSQL statementsNext: PLAN allowed in trigger code

LEAVE

Tip

Find a more recent version at Firebird 5.0 Language Reference: LEAVE

Available in: PSQL

Added in: 1.5

Description: LEAVE immediately terminates a WHILE or FOR loop and continues with the first statement after the loop.

Example: 

while (b < 10) do
begin
  insert into Numbers(B) values (:b);
  b = b + 1;
  when any do
  begin
    execute procedure log_error (current_timestamp, 'Error in B loop');
    leave;
  end
end
c = 0;
while (c < 10) do
begin
  ...
  ...
end

If an error occurs during the insert, the event is logged and the loop terminated. The program continues at the line of code reading c = 0;

Prev: FOR SELECT ... INTO ... DOFirebird Documentation IndexUp: PSQL statementsNext: PLAN allowed in trigger code
Firebird Documentation IndexFirebird 1.5 Language Ref. UpdatePSQL statements → LEAVE