want to create a dynamic insert statement to insert the audit record,
and have SQL be able to retrieve the contents of the field name in
the trigger buffer, and not have to hardcode every column name.
example, if I detect a change in a city field (name is ACCITY), I
want to load the contents of the “before” buffer’s ACCITY
field into the BEFOREDATA field in the inserted audit record, and
also load the contents of the “after” buffer’s ACCITY field
into the AFTERDATA field in the inserted audit record.
you have any ideas on how to do that? Would a SQL (V6R1M0) descriptor help me
with this? I’m hoping there is an easy way to do this rather than
hardcoding a bunch of IF/THEN statements for each field in a file
that needs to have changes tracked.
Have you considered turning on the journaling feature? This sounds like it would suit your needs.