Reproduced original address: http://blog.csdn.net/zftang/article/details/6586996
We all know that a trigger does not require commit and cannot be written to it. The trigger and the DML that triggers it are the same transaction.
DML is submitted, and trigger operations are also submitted, so no commit is required; otherwise, an error message is generated.
Of course, if you must write the commit statement in the trigger, it is also possible. You can use the Oracle autonomous transaction to process it. The autonomous transaction is equivalent to the subtransaction in a transaction.
Under normal circumstances, Oracle requires that DDL (Create/alter/drop) Statements and commit/rollback statements cannot be run in triggers, because DDL operations are implicitly submitted, A trigger does not allow commit. For example, if you add a DDL statement to the trigger, this implicit commit will cause an error message. However, in special circumstances, you need to use DDL statements in the trigger.
The following solutions can be taken:
Create or replace trigger trigger_table1 after update or insert on Martin. table1 for each rowdeclare Pragma autonomous_transaction; -- homemade transaction processing begin -- call the sharding stored procedure. Each trigger splits only one mc_print (: New. ID,: New. name); Commit; end trigger_table1;