Scalar subquery expressions

2024-03-05 01:54:26  Updated

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 RETURNING clause of a DML statement

  • Used in the definition of a function-based index

  • Used in the CHECK constraint

  • Used in a GROUP BY clause

  • Used in statements unrelated to a query, such as CREATE PROFILE

Contact Us