-746 THE SQL STATEMENT IN FUNCTION, TRIGGER, OR IN STORED PROCEDURE name VIOLATES THE NESTING SQL RESTRICTION
Explanation
If a table is being modified by an INSERT, DELETE, UPDATE, or MERGE statement, the table cannot be accessed by the lower level nested SQL statement.
System action
The SQL statement fails.
Programmer response
Remove the failing SQL statement from the named function, stored procedure, or trigger.
SQLSTATE
57053