cancel
Showing results for 
Search instead for 
Did you mean: 

Identifying transaction ID in a trigger

0 Kudos
2,625

Hello, all

I have a logging system, which works with triggers. It registers changes to fields writes them to a separate logging table. Now I have a new requirement to identify all changes, which occurred inside the same transaction. Is there a way to find out transaction id from the "after update" trigger code?

Thank you

Arcady

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Would sa_transactions( ) procedure be helpful here or is it time-consuming?

VolkerBarth
Contributor
0 Kudos

Ah, thanks for the pointer - I wasn't aware of that procedure's column transaction_id!

Can't tell on the performance but the following query could give the desired result (note, that this can generally return NULL but it should return a value within a trigger...):

select transaction_id
from sa_transactions()
where connection_num = connection_property('Number');

Nevertheless, as these transaction_ids are volatile, I don't know whether they are useful for later diagnostics... I (wildly) guess that should at least include transaction log offsets...