Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
36
Добавлен:
18.03.2015
Размер:
608.7 Кб
Скачать

SQL Language Enhancements

INSERT INTO ERROR_LOG (...) VALUES (SQLCODE, ...);

EXCEPTION;

END

3) Run-time error codes

See SQLCODE / GDSCODE (above).

(1.5) LEAVE | BREAK statement

Terminates the flow in a loop, causing flow of control to move to the statement following the END statement that completes that loop. Available for WHILE, FOR SELECT and FOR EXECUTE language constructs only, otherwise a parser error will be thrown. Available in triggers as well as stored procedures.

Important

The SQL-99 standard keyword LEAVE deprecates the existing use of BREAK.

Syntax Pattern

LEAVE;

Examples

i)

BEGIN <statements>;

IF (<conditions>) THEN LEAVE;

<statements>; END

ii)

WHILE (<condition>) DO BEGIN

<statements>; WHEN ... DO

LEAVE;

END

The condition that branches to a LEAVE statement must be inside a block that is controlled by a looping construct (i.e., WHILE or FOR SELECT...INTO...DO).

Important

It is emphasised that LEAVE will not terminate other types of BEGIN...END block.

46

Соседние файлы в папке doc