Subject Copying Related Table data
Author gorepj
I have two tables master, detail. The tables are related using a
foreign key with cascaded updatees etc. When a record's primary key
updates in the master table I want to copy the pre-modified data (old
version) to the master table and also its related child records in
the detail table so that I create a new version of that record using
triggers. This way I keep the old version of the records and new
version of the records in the sae table.

e.g. before Update
Master table
PK_MAST DATA_MASTER
1 MyData

Detail Table
KEY_MAST SEQN DATA_DETAIL
1 1 My Detail Data

After Update
PK_MAST DATA_MASTER
1 MyOldData
2 MyNewData

Detail Table
KEY_MAST SEQN DATA_DETAIL
1 1 My Old Detail Data
2 2 My New Data

I havn't been able to do this without violating foreign key or
primary key. Has anyone got any ideas.
Regards
Peter Gore