Subject | Execution order for cascaded updates and before update triggers |
---|---|
Author | martin.agren@framtiden.goteborg.se |
Post date | 2004-02-03T10:44:18Z |
Hi there,
I am cascading an update. One column is a sequential index within the value
of another column
Col1 Col2 Col3
a 1 abc
a 2 abc
b 1 abc
b 2 abc
where col1+col2 make up the PK and the col2 'index' is set by an on insert
trigger.
If I want to change the value of col1 from a to b for a record, I obviously
wld have to change the col2 index in a before update trigger.
I then cascade the update of these two columns to the dependent tables.
It seems, however, as if the cascade occurs before the on update trigger,
resulting in a key viol in the dependent table.
Is this what happens, and is there a workaround?
/Martin
I am cascading an update. One column is a sequential index within the value
of another column
Col1 Col2 Col3
a 1 abc
a 2 abc
b 1 abc
b 2 abc
where col1+col2 make up the PK and the col2 'index' is set by an on insert
trigger.
If I want to change the value of col1 from a to b for a record, I obviously
wld have to change the col2 index in a before update trigger.
I then cascade the update of these two columns to the dependent tables.
It seems, however, as if the cascade occurs before the on update trigger,
resulting in a key viol in the dependent table.
Is this what happens, and is there a workaround?
/Martin