暂无图片
ogg参数filter的使用问题【急】
我来答
分享
Jacky
2022-07-21
ogg参数filter的使用问题【急】
暂无图片 10M

问题:ogg 里多个filter_clause语法怎么写?


有这么个场景:同步某张表里符合where 条件的记录,查阅资料,发现ogg不支持where里的模糊匹配,所以符合where like条件的记录,都改成调用函数@strfind来匹配


比如:

同步employee表里job_id like 'AD_VP'的记录

在ogg replicat端过滤:

MAP pdb1.hr.employees, TARGET orclpdb.user1.employees,filter ( @strfind (job_id,'AD_VP') > 0) ;

测试同步成功。


但多个filter条件该怎么写呢?比如我要同步job_id like 'AD_VP' or job_id like 'AD_PRES'的记录,语法怎么写都报错。


请问应该怎么解决多个模糊匹配问题? 



我来答
添加附件
收藏
分享
问题补充
3条回答
默认
最新
Jacky

已解决,在filter括号里加个or就行了

MAP pdb1.hr.employees, TARGET orclpdb.user1.employees,filter ( @strfind (job_id,'AD_VP') > 0 or @strfind (job_id,'AD_PRES') > 0);

暂无图片 评论
暂无图片 有用 0
暂无图片
张sir

ogg官方文档里又类似的多个条件的写法,参考下。


https://docs.oracle.com/goldengate/c1230/gg-winux/GWUAD/mapping-and-manipulating-data.htm#GWUAD443


The following example returns all records when the amount column is over 10,000 and does not cause a record to be discarded when amount is absent.

WHERE (amount = @PRESENT AND amount > 10000)
暂无图片 评论
暂无图片 有用 0
杨卓

Primary Note for Oracle GoldenGate for Filtering and Transformation Data (Doc ID 1450495.1)
没看到mos给出模糊匹配,但是Mos说支持多个filter,省事的话,2个条件,2条map filter 不同的条件,或者整2个进程拆分一下,如下链接说还有其它方式可以根据sql语句没测试过,建议测试后执行。
https://blog.51cto.com/u_10226511/3150728

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏