This content has been marked as final. Show 1 reply
You could use SQL to do a lookup/comparison, then raise an error, and specify an action for that error (ABEND).
Example from the Apress GoldenGate book:
There are other things going here than what you are looking for, but the idea is that you can raise your own exception and specify what to do when it happens.
MAP HR.EMPLOYEES, TARGET HR.EMPLOYEES, & REPERROR (90000, DISCARD), & SQLEXEC (ID checkemployee, ON UPDATE, & QUERY "select count(*) empduplicate from HR.EMPLOYEES where employee_id = ? and & employee_timestamp > ?", & PARAMS (p1 = employee_id, p2 = employee_timestamp), BEFOREFILTER, ERROR REPORT, & TRACE ALL),& FILTER (checkemployee.empduplicate = 0, ON UPDATE, RAISEERROR 90000);
You could also make a ghost/copy table and convert the original update into an insert, and if there is a collision on the insert (because the value already exists), let GoldenGate abend on its own. Of course, you have the overhead of a duplicate table and having to code the test, but that's not much different than having to do a lookup on the target in the first place.
Then again, if it can't happen on the target, why was it allowed to happen on the source?