A scalar subquery expression is a subquery that returns one row that contains multiple column values.
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 cases:
Used as the default value of a column
Used in a hash function
Used in the
RETURNINGclause of a DML statementUsed in the definition of a function-based index
Used in the
CHECKconstraintUsed in a
GROUP BYclauseUsed in statements unrelated to a query, such as
CREATE PROFILE