Internal functions and directives
Conditional statements and loops
Changing the nullability of a domain
Testing for NULL and equality in practice
Firebird Null Guide: NULL behaviour and pitfalls in Firebird SQL
The following built-in functions return NULL
if at least one argument is NULL
:
CAST()
EXTRACT()
GEN_ID()
SUBSTRING()
UPPER()
LOWER()
BIT_LENGTH()
CHAR[ACTER]_LENGTH()
OCTET_LENGTH()
TRIM()
Note
|
Notes
|
FIRST
, SKIP
and ROWS
The following two directives crash a Firebird 1.5.n or lower server if given a NULL
argument.In Firebird 2, they treat NULL
as the value 0
:
FIRST
SKIP
This new Firebird 2 directive returns an empty set if any argument is NULL
:
ROWS
In new code, use ROWS
, not FIRST
and SKIP
.
Predicates are statements about objects that return a boolean result: true
, false
or unknown
(= NULL
).In computer code you typically find predicates in places where a yes/no type of decision has to be taken.For Firebird SQL, that means in WHERE
, HAVING
, CHECK
, CASE WHEN
, IF
and WHILE
clauses.
Comparisons such as “x > y
” also return boolean results, but they are generally not called predicates, although this is mainly a matter of form.An expression like Greater( x, y )
that does exactly the same would immediately qualify as a predicate.(Mathematicians like predicates to have a name — such as “Greater” or just plain “G” — and a pair of parentheses to hold the arguments.)
Firebird supports the following SQL predicates: IN
, ANY
, SOME
, ALL
, EXISTS
and SINGULAR
.
Note
|
It is also perfectly defensible to call “ |