<< PLAN allowed in trigger code | FB 2.5 Language Reference | UDFs callable as void functions >>

Subqueries as PSQL expressions

Changed in: 2.5

Description

Previously, subqueries could not be used as value expressions in PSQL, even if they returned a single value. This made it necessary to use SELECT ... INTO, often assigning the result to a variable that wouldn't have been necessary otherwise. Firebird 2.5 and up support the direct use of scalar subqueries as if they were simple value expressions.

Examples

Constructions like the following are now valid PSQL:

 var = (select ... from ...);

 if ((select ... from ...) = 1) then ...

 if (1 = any (select ... from ...)) then ...

 if (1 in (select ... from ...)) then ...

Of course, in the first two examples you have to be sure that the SELECT doesn't return multiple rows!

back to top of page
<< PLAN allowed in trigger code | FB 2.5 Language Reference | UDFs callable as void functions >>