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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

leave;<br />

end<br />

end<br />

c = 0;<br />

PSQL statements<br />

The next example uses labels. “Leave LoopA” terminates the outer loop, “leave LoopB” the inner<br />

loop. Notice that a plain “leave” would also suffice to terminate the inner loop.<br />

stmt1 = 'select Name from Farms';<br />

LoopA:<br />

for execute statement :stmt1 into :farm do<br />

begin<br />

stmt2 = 'select Name from Animals where Farm = ''';<br />

LoopB:<br />

for execute statement :stmt2 || :farm || '''' into :animal do<br />

begin<br />

if (animal = 'Fluffy') then leave LoopB;<br />

else if (animal = farm) then leave LoopA;<br />

else suspend;<br />

end<br />

end<br />

Available in: PSQL<br />

Added in: 2.0<br />

OPEN cursor<br />

Description: Opens a previously declared cursor, executing its SELECT statement and enabling it to fetch records<br />

from the result set.<br />

Syntax:<br />

OPEN cursorname;<br />

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

Changed in: 1.5<br />

PLAN allowed in trigger code<br />

Description: Before <strong>Firebird</strong> 1.5, a trigger containing a PLAN statement would be rejected by the compiler. Now<br />

a valid plan can be included and will be used.<br />

Changed in: 2.0<br />

UDFs callable as void functions<br />

107

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

Saved successfully!

Ooh no, something went wrong!