首页 技术 正文
技术 2022年11月18日
0 收藏 882 点赞 3,673 浏览 939 个字

最近生产库反应出一个问题,某张表的主键ID并没有按照原计划的期望增加,而是间歇性跳号,每次跳2万多,经过研究发现是某个同步过程的merge into引起的,具体语句如下

merge into t_ifi_invest_ordplan_detail a
using (select f.client_id,
f.fund_account,
f.fund_code,
f.fund_company,
f.balance,
f.allotno,
f.en_fund_date,
f.start_date,
f.end_date,
s.cpid,
s.cpmc
from t_ifi_ofrationtime f
left join t_ifi_singlefund_info s
on f.fund_code = s.cpdm
where f.deal_flag = ‘0’ –过滤当日取消操作
) t on (a.allotno = t.allotno)
when not matched then
insert
(a.plan_detail_id,
a.plan_id,
a.client_id,
a.fund_account,
a.fund_code,
a.fund_company,
a.fix_invest,
a.allotno,
a.fund_id,
a.plan_name,
a.openacc_flag)
values
(seq_ifi_invest_ordplan_detail.nextval,
 seq_ifi_invest_ordplan.nextval,
t.client_id,
t.fund_account,
t.fund_code,
t.fund_company,
t.balance,
t.allotno,
t.cpid,
t.cpmc || ‘普通定投’ || seq_ifi_invest_ordplan.currval,
‘1’)

经过实验发现,虽然每次同步新增的数据不多,但是序列总是跳一个波段,而跳的间隔数刚好是本次using里面查到的数据总量,很是奇怪。

解决方法:单独写个获取序列的方法,将merge into 里面的seq_ifi_invest_ordplan_detail.nextval换成用方法获取序列,再次测试,问题解决。究竟原因目前还不得知,有知道的可以留言告知下,谢谢。

下一篇: win8配置JDK
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,085
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,560
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,409
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,182
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,819
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,902