Writing Your Own Conflict Resolution Handler
If the conflict resolution techniques that Oracle supplies do not meet your requirements, you are free to write your own routine. An example of such a routine is the one with the delete conflict handler shown earlier in this chapter. When you sit down to write your conflict resolution function, it is probably easiest to begin with the code that Oracle generates for the corresponding built-in resolution technique, which you can extract from the DBA_SOURCE data dictionary view. You should also consider building a notification method.
Oracle’s requirements for user-defined conflict resolution techniques are as follows:
Use PL/SQL.
Return Boolean TRUE if successful, FALSE otherwise.
Update handlers require Old, New, and Current column values for columns specified in the parameter_column_name parameter of DBMS_REPCAT.ADD_UPDATE_RESOLUTION.
Delete handlers require Old column values for the entire row.
Uniqueness handlers require New values for columns specified in the parameter_column_name parameter of DBMS_REPCAT.ADD_UPDATE_RESOLUTION.
Do not perform DDL (i.e., through dynamic SQL).
Do not perform transaction control (e.g., ROLLBACK).
Do not perform session control (e.g., ALTER SESSION...).
Do not perform system control (e.g. ALTER SYSTEM...).
When you are ready to add your conflict resolution function to the table, follow these steps:
Quiesce the replication group.
Call DBMS_REPCAT.CREATE_MASTER_REPOBJECT to make your function a replicated object.
Call ...