-740   FUNCTION name IS DEFINED WITH THE OPTION MODIFIES SQL DATA WHICH IS NOT VALID IN THE CONTEXT IN WHICH IT WAS INVOKED

Explanation

A user-defined function that is defined with the MODIFIES SQL DATA clause was invoked in an invalid context.

name
The name of the user-defined function.
A user-defined function that is defined with MODIFIES SQL DATA is only allowed in:
  • A VALUES clause of an insert operation
  • A SET clause of an update operation
  • A VALUES statement in a trigger
  • A SET Assignment statement
  • A CALL procedure statement

System action

The SQL statement failed.

Programmer response

Remove the user-defined function from the failing statement. or remove the MODIFIES SQL DATA option from the definition of the function.

SQLSTATE

51034