In general, any replication tool replicates data in similar objects. We need an identical copy of the source and target if we want to do replication.
Oracle Golden Gate is a strong tool which provides the capability to map columns between two dissimilarly structured database table. This feature can be implemented in Golden Gate with ColMap clause in Table and Map parameter.
Column Mapping Example :
Map hr.accounts , Target hr.details_account , ColMap(USEDEFAULTS , account_code=@StrCat(company_code,account_code);
In the above example, we can see that I have used two arguments in ColMap clause.
1. USEDEFAULTS: Any columns in accounts and details_account table which have the same name will be replicated as it is.
2. StrCat: I have concatenated two columns using strcat. It will concatenate the company code and account code and put them in one column account code.
We can use ColMap this way.
Data Transformation :
Oracle Golden Gate provides the capability of transforming data by using a set of built-in functions. Transformation function can be applied for either extract or replicat. Additional functions can be used by using your own logic through user exits.
We can use the following column conversations :
- Perform string and number conversation.
- Extract portions of strings or concatenate columns
- Compare strings or numbers
- We can use single or nested IF to evaluate string, number or other values to find appropriate value and format for target columns etc
Let us see some built-in ‘@’ functions :
@IF Function: This function can be used with Oracle golden gate other functions to check conditional argument.
variable = @if(condition ,if_true_val,if_false_val)
Age = @if (age < 16 , 'M','J')
@Date Functions: There are several date functions available with Golden Gate: Date, Datadiff, Datenow
If you want to be updated with all our articles send us an Invitation or Follow us:
Telegram Channel: https://t.me/helporacle
Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/
Joel Perez’s LinkedIn: Joel Perez’s Profile
LinkedIn Group: Oracle Cloud DBAAS
Facebook Page: OracleHelp