Using the 'cdrsession' option
The 'cdrsession' option to the DBINFO() function detects if an INSERT, UPDATE, or DELETE statement is being performed as part of a replicated transaction.
You might want to design triggers, stored procedures,
or user-defined routines to take different actions depending on whether
a transaction is being performed as part of Enterprise Replication.
The 'cdrsession' option of the DBINFO() function
returns 1
if the thread performing the database operation
is an Enterprise Replication apply or sync thread; otherwise, the
function returns 0
.
The following example shows an SPL function that uses the 'cdrsession' option to determine if a thread is performing an Enterprise Replication operation:
CREATE FUNCTION iscdr ()
RETURNING int;
DEFINE iscdrthread int;
SELECT DBINFO('cdrsession') into iscdrthread
from systables where tabid = 1;
RETURN iscdrthread;
END FUNCTION