Forum Stats

  • 3,853,838 Users
  • 2,264,283 Discussions
  • 7,905,465 Comments

Discussions

GG 19 - C user exit GET_COLUMN_VALUE_FROM_INDEX

Adrian_F
Adrian_F Member Posts: 5 Blue Ribbon
edited Jul 14, 2022 11:43PM in GoldenGate

Hi,

Does anybody know if, for a C user exit, GET_COLUMN_VALUE_FROM_INDEX works for source_or_target set to EXIT_FN_TARGET_VAL ?

I need to check if a specific record is present on the target DB so I figure out if this is a replication conflict or not.

Due to other constraints, I must use a C user exit.

The user exit is loaded on the Replicat side.

Both source and target DBs are Oracle.


many thanks,

Adrian

Answers

  • K.Gan
    K.Gan Member Posts: 2,815 Bronze Crown

    I have then to set source_or_target source for extract and target for replicat without much thought. If the table structure is identical on both sides I doubt there is a difference. On the replicat setting one or the other does 'make sense' as the source metadata is in the trail and it can get the target metadata from the DB it is connected to. I suppose setting this to target for extract does not make sense.

  • Adrian_F
    Adrian_F Member Posts: 5 Blue Ribbon
  • Adrian_F
    Adrian_F Member Posts: 5 Blue Ribbon

    OK, so I am able to successfully call GET_COLUMN_VALUE_FROM_INDEX for the target.

    Still, the column value I get is strange.

    For the source (before and after) works like a charm.

    For the target, I wonder if there are any restrictions about the before/after indicator or about the format (column_value_mode).


    thanks.

  • K.Gan
    K.Gan Member Posts: 2,815 Bronze Crown

    Set a breakpoint in your user exit and see the before and after buffers. In extract I suggest that you log all columns (using ADD TRANDATA ALLCOLS , etc) and include UPDATERECORDFORMAT FULL. There is no restrictions per se if the indicator says before or after. All depends on what you set. For example if you compressed the update and you attempt to get an after image on a column that wasn't updated, you won't get anything. I also wouldn't be surprised if you get garbage. By logging all cols and UPDATERECORDFORMAT FULL you get everything. You need to experiment quite a bit including your original query about target or source settings.

  • Adrian_F
    Adrian_F Member Posts: 5 Blue Ribbon

    Thanks. On the incoming record (from Extract) I can read the columns (before and after, yes with all these settings you mention) and get the right column values. I am more concern on the target side. If I try to read a column value by index (probably by name is the same), it seems I get some garbage data. So, I feel like I'm missing something to allow me to properly read columns from target.

  • K.Gan
    K.Gan Member Posts: 2,815 Bronze Crown

    Is your table structure different between target and source? It looks like you are mapping on an incorrect structure. Dump the whole record in hex using a hexeditor or within gdb (assume you use this) and likewise your garbled data. You might be able to see where it is out of alignment. That is usually what I do when I get garbaged. I supposed you have set source_or_target to source and then to target to see if you get different results. Also attempt to get the first column although this is not what you want, i.e. get the easiest column to work. Then you can mess around with the middle portions.

  • Adrian_F
    Adrian_F Member Posts: 5 Blue Ribbon

    Many thanks, this will probably help -- reading the first column.

    I'll try that. The column I try to read from target is at index 5 and reading same column from source (before or after) works like a charm.

    The table structure is the same.

    I'll read the first column and see what I get.

    thanks.