User tokens
User tokens are GoldenGate environment variables that are captured and stored in the trail record for replication. They can be accessed via the @GETENV
function which we have already touched upon the @GETENV
function in the previous section, Using and Defining macros. You can use token data in column maps, stored procedures called by SQLEXEC
, and of course macros.
A vast array of user tokens exists, too many to list in this book. You can use the TOKENS
option of the Extract TABLE
parameter to define a user token and associate it with GoldenGate environment data. For example:
TABLE SRC.CREDITCARD_ACCOUNTS, & TOKENS (TKN_OSUSER = @GETENV("GGENVIRONMENT","OSUSERNAME"), & TKN_DBNAME = @GETENV ("DBENVIRONMENT","DBNAME"), & TKN_HOSTNAME = @GETENV ("GGENVIRONMENT","HOSTNAME"), & TKN_COMMITTIME = @GETENV("GGHEADER","COMMITTIMESTAMP") & TKN_BEFOREAFTERIND = & @GETENV(("GGHEADER","BEFOREAFTERINDICATOR"));
The defined user tokens can then be called within a MAP
statement...