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.

Operators and predicates<br />

if (New.Job is distinct from Old.Job)<br />

then post_event 'job_changed';<br />

IS [NOT] DISTINCT FROM always returns true or false, never NULL (unknown). The “=” and “” operators,<br />

by contrast, return NULL if one or both operands are NULL. See also the table below.<br />

Table 10.1. Comparison of [NOT] DISTINCT to “=” and “”<br />

Operand characteristics<br />

Results with the different operators<br />

= NOT DISTINCT DISTINCT<br />

Same value true true false false<br />

Different values false false true true<br />

Both NULL NULL true NULL false<br />

One NULL NULL false NULL true<br />

Available in: DSQL, PSQL<br />

Added in: 2.0<br />

NEXT VALUE FOR<br />

Description: Returns the next value in a sequence. SEQUENCE is the SQL-compliant term for what InterBase<br />

and <strong>Firebird</strong> have always called a generator. NEXT VALUE FOR is fully equivalent to GEN_ID(..., 1) and is the<br />

recommended syntax from <strong>Firebird</strong> 2.0 onward.<br />

Syntax:<br />

Example:<br />

NEXT VALUE FOR sequence-name<br />

new.cust_id = next value for custseq;<br />

NEXT VALUE FOR doesn't support increment values other than 1. If you absolutely need other step values, use<br />

the legacy GEN_ID function.<br />

See also: CREATE SEQUENCE, GEN_ID()<br />

See ANY<br />

SOME<br />

120

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

Saved successfully!

Ooh no, something went wrong!