Insert and update operations

An SPL routine has the restriction that it cannot perform INSERT or UPDATE operations in an SPL routine that is invoked from a DML statement. This restriction ensures that the SPL routine cannot change the state of the statement that invoked it.

This restriction is relaxed for UDRs. The database server issues an error if the table that is being accessed in the UDR is referenced in the statement that invoked it. If this is a nested UDR invocation, then the database server checks the chain of parent queries.

If a UDR is called as part of an INSERT, UPDATE, DELETE, or SELECT statement and if the referenced table appears in the chain of statements that eventually invoked the UDR, the called routine cannot execute any of the following statements:
  • ALTER FRAGMENT
  • ALTER INDEX
  • ALTER TABLE
  • DROP INDEX
  • DROP SYNONYM
  • DROP TABLE
  • DROP TRIGGER
  • DROP VIEW
  • RENAME COLUMN
  • RENAME TABLE