on 2021 Apr 28 2:22 PM
I want to insert another row according to the value of inserted row. But I got "modification of subject table in trigger not allowed" error. How could I get rid of this error.
The sample trigger is like that:
CREATE TRIGGER ex_trigger
BEFORE INSERT ON "example_table"
REFERENCING NEW ROW MYNEWROW
FOR EACH ROW
BEGIN
IF (comparison true ) then
insert into example_table (col1,col2,col3) values(:MYNEWROW.col1+1,:MYNEWROW.col2,:MYNEWROW.col3);
END IF
END
Any help will be appreciated
Thanks
Request clarification before answering.
Hi Arif,
The error message "modification of subject table in trigger not allowed" means that any modification (INSERT/UPDATE/DELETE/REPLACE) of a subject table that a trigger is defined on is not allowed in the trigger body.
Since your trigger has been defined on example_table, the statement starting with "insert into example_table (col1,col2,col3)" inside the trigger's body is throwing this error.
Please see CREATE TRIGGER Statement (Data Definition) page from SAP Help Portal for detailed information on creating triggers, particularly, the Description section on this page explains various rules that apply on triggers.
Thank you,
Jyotsana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
46 | |
9 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.