Triggers do not require a commit
I can't write a commit.
The trigger and the DML that triggered it are the same transaction
DML commits, the action of the trigger is also submitted, or it is rolled back together.
Of course, if you must write a commit in a trigger,
Then use the autonomous business
Equivalent to a child transaction in a transaction
Under normal circumstances, Oracle stipulates that DDL statements and Commit,rollback statements cannot be run in triggers.
There are two ways to solve this problem:
1. In the trigger can be added: pragma autonomous_transaction; Represents free transaction processing.
Such as:
Create or Replace Trigger Update_relaction_sample
Before update on SAMPLE
Referencing
For each ROW
DECLARE
pragma autonomous_transaction;
Verror int;
BEGIN
verror:=0;
Update Sample_relation t set t.status=:new.status where t.sample_id=:new.trim_idnumeric;
If:new.status= ' C ' and:old.status<> ' C ' then
Proc_synch_procedure_data (: New.trim_idnumeric,verror);
End If;
Commit
END update_relaction_sample;
2. You can also write a method to pass DLL statements to this method to execute.
Comments:
DDL statements: DDL statement terms define and manage objects in the database, such as Create,alter,drop,truncate, and DDL operations are implicitly committed! The operation takes effect immediately and the original data is not placed in the rollback segment and cannot be rolled back. Operation does not trigger trigger
The DML (data manipulation Language) Manipulation Language command enables users to query the database and manipulate data in existing databases. such as Insert,delete,update,select, are all DML.
Triggers in Oracle increase stored procedure commit problem