21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

if (num < 1) then break;<br />

suspend;<br />

num = num - 1;<br />

end<br />

phrase = '*** Ready! ***';<br />

suspend;<br />

end<br />

PSQL statements<br />

This selectable SP returns at most num rows from the table Phrases. The variable num is decremented<br />

in each iteration; once it is smaller than 1, the loop is terminated with BREAK. The program then<br />

continues at the line “phrase = '*** Ready! ***';”.<br />

Important<br />

Available in: PSQL<br />

Added in: 2.0<br />

Since <strong>Firebird</strong> 1.5, use of the SQL-99 compliant alternative LEAVE is preferred.<br />

CLOSE cursor<br />

Description: Closes an open cursor. Any cursors still open when the trigger, stored procedure or EXECUTE<br />

BLOCK statement they belong to is exited, will be closed automatically.<br />

Syntax:<br />

CLOSE cursorname;<br />

Example: See DECLARE ... CURSOR.<br />

Available in: PSQL<br />

Description: Declares a PSQL local variable.<br />

Syntax:<br />

DECLARE [VARIABLE] varname ;<br />

DECLARE<br />

::= [NOT NULL] [] []<br />

| CURSOR FOR (select-statement)<br />

::= sql_datatype | [TYPE OF] domain<br />

::= COLLATE collation<br />

::= {= | DEFAULT} value<br />

96

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!