Forum Stats

  • 3,874,814 Users
  • 2,266,777 Discussions
  • 7,911,968 Comments

Discussions

Goldengate getupdatebefores column

673238
673238 Member Posts: 1
edited Oct 1, 2010 2:11PM in GoldenGate
Hi Friends ,
i have a Table A with column X & Y @SOURCE Database and Table B with X1 and Y1 columns @ TARGET Database . i want to track column y at source table A when ever there is an update or insert on that column Y has to be compared with the column Y1 of table B @ Target db if it is diffrent then changed value,then apply changed value has to be inserted in to column Y1 or else ignore .can any one explain me in simple steps to achive this Task .

Thanks in advance

ESSKAY

Answers

  • User152973
    User152973 Member Posts: 148
    Hi,

    If you haven't gone through this doc from Metalink, then here it is [ID 1085140.1]. It's briefly explained about the GETUPDATEBEFORES and also your specification. Hope this works.

    Rows can be ignored rather or discarded rather than sent to the database if before/after filters are used in the replicat. This can cause the amount of data to be sent to the database to be reduced if certain data is not changed. This is of use in high volume instances where not all row changes are useful.
    Solution
    Sample:


    There are two parts to it.

    First, on the Oracle side, supplemental logging has to be enabled for all the columns you are going to use in the target table. The up side of this is that you won't need to check if a column is present with your function. In fact, that was part of the problem.


    add trandata tab8811s cols ( name, city, state)

    Second, you need to compare before after images with @streq. Here is my sample:


    REPLICAT r8811
    reperror 21000, discard

    SOURCEDEFS e:\gg\Teradata\DIRDEF\def8811.def
    DISCARDFILE e:\gg\teradata\discards\r8811.txt, PURGE
    GETUPDATEBEFORES

    TARGETDB vmprime_mzerger, USERID mzerger, PASSWORD mzerger

    -- if name and city are both unchanged, do not replicate update

    MAP mzerger.tab8811s
    TARGET mzerger.tab8811t,
    filter (
    on update,
    (
    ((1 = @streq (before.name, name)) ) AND
    ((1 = @streq (before.city, city)) )
    ),
    raiseerror 21000
    )
    ;


    Thanks.
This discussion has been closed.