Home > database >  Bulk insert trigger how to do
Bulk insert trigger how to do

Time:09-19

The create or replace the TRIGGER FORMSON_0021_I
Before the INSERT ON seeyon. Formson_0021
For each row
Declare
F_ID NUMBER (19, 0) :=0;
F_id_10 decimal (20, 2);
PRAGMA AUTONOMOUS_TRANSACTION;
The BEGIN
IF INSERTING THEN
Select the id into F_ID from formson_0021 where sort=: new. Sort - and FORMMAIN_ID=1: new. FORMMAIN_ID;
IF F_ID & gt; 0 THEN
The select field0010 into f_id_10 from formson_0021 where id=F_ID;
IF: new field0009 is not null THEN
: new FIELD0010:=f_id_10 + : new. Field0009;
END IF;
IF: new field0013 is not null THEN
: new FIELD0010:=f_id_10 - : new. Field0013;
END IF;
END IF;
END IF;
COMMIT;
END;

CodePudding user response:

Don't deal with actual business in the trigger, don't write more autonomous transactions,

Look at your code should only need to rewrite the insert statement, the table structure, test data, the demand to,

CodePudding user response:

This is what to do?

CodePudding user response:



Balance is equal to a balance on income and expenditure

CodePudding user response:

It is not necessary to write a trigger, written in this statement
Insert into tab1 (.. . . )
The select.. . , (select balances the from tab1 where... ) from dual;

CodePudding user response:

This statement is how to write? Used dual table

CodePudding user response:

With the execute immediate statement can be executed immediately, detail can baidu, very simple, I wrote a similar like you
  • Related