Start of change

-582   THE SEARCH-CONDITION IN A SEARCHED-WHEN-CLAUSE OF A CASE IS NOT VALID IN THE CONTEXT IN WHICH IT WAS SPECIFIED. THE SEARCH CONDITION CONTAINS A QUANTIFIED PREDICATE OR AN IN PREDICATE THAT INCLUDES A FULLSELECT, AND THESE ARE NOT ALLOWED IN THE SPECIFIED CONTEXT.

Explanation

The search-condition in a searched-when-clause specifies a quantified predicate, an IN predicate, or an EXISTS predicate, but is not allowed. However, an IN predicate is allowed within a select list or VALUES clause if that IN predicate explicitly includes a list of expressions.

The search-condition in a searched-when-clause specifies a quantified predicate or an IN predicate that includes a fullselect. A CASE specification that includes either of these cannot be used in the following contexts:

  • A SELECT list
  • A VALUES clause of an INSERT or MERGE statement
  • A SET or assignment clause of an UPDATE, MERGE, or DELETE statement
  • The right side of a SET or an assignment statement
  • A column mask or row permission definition

The search-condition in a searched-when-clause specified an EXISTS predicate. A CASE specification that includes either of these cannot be used in the following contexts:

  • A VALUES clause of an INSERT or MERGE statement
  • The right side of a SET or an assignment statement
  • The diagnostic-string-expression of a SIGNAL statement
  • The expression of a VALUES statement

System action

The statement cannot be processed.

Programmer response

Correct the syntax, and reissue the statement.

SQLSTATE

42625

End of change