Tuesday, May 5, 2009

KEY-DUPREC Trigger

Key-DupRec trigger is used to Copy previous record to current record in Create Record Mode. Whole record contains from last record including Sequence numbers are copied and newly record is not marked for validation. Item level validations are fired unless we go to item of newly created record and try to change it. If you are using PRE-INSERT trigger to generate Record last Change Details, auditing and Sequence number then duplicated records will have values calculated/generated in PRE-INSERT trigger.

Its is always better idea to code constraints to database side. If you code constraints at database end then

1) Constraint violating record never will be in database.

2) If your application have different middle tier and client tier implemented in different technologies/channels then you can just catch these ora errors and make them user friendly before displaying.