cancel
Showing results for 
Search instead for 
Did you mean: 

modification of subject table in trigger not allowed

former_member656107
Discoverer
0 Kudos
740

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

View Entire Topic
jyotsana_gupta
Product and Topic Expert
Product and Topic Expert
0 Kudos

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