A scalar subquery expression is a subquery that returns a single column value.
If the subquery returns zero rows, the value of the scalar subquery expression is NULL. If the subquery returns multiple rows, the database returns an error. Most expressions can use a scalar subquery expression as a parameter.
A scalar subquery is an invalid expression in the following situations:
As a column default value.
In a hash function.
In the
RETURNINGclause of a DML statement.In the definition of a function index.
In a
CHECKconstraint.In the
GROUP BYclause.In statements unrelated to the query, such as
CREATE PROFILE.
