最近生产库反应出一个问题,某张表的主键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换成用方法获取序列,再次测试,问题解决。究竟原因目前还不得知,有知道的可以留言告知下,谢谢。

最新文章

  1. APP里如何添加本地文本
  2. JS控制div跳转到指定的位置的解决方案总结
  3. List 用法和实例(转载)
  4. yii2.0邮箱发送
  5. [MCSM] Slice Sampler
  6. 函数fseek() 用法(转)
  7. poj-1469-COURSES-二分图匹配-匈牙利算法(模板)
  8. 【转】Java中 List的遍历
  9. LNMP环境出现”504 gateway time-out”错误的解决方案
  10. 【排序】表插入排序算法(C语言版)
  11. 事务不提交,也有可能写redo和数据文件
  12. Python之列表&元组&字典
  13. Nodejs的多线程
  14. Linux下部署开源版“禅道”项目管理系统
  15. tp引入header文件~
  16. mysql 性能优化思路 - mysqldumpslow /tmp/mysql-slow.log 字符集 utf-8 create database
  17. linux硬盘挂载-新硬盘挂载和扩容硬盘挂载
  18. 【Codeforces 1110D】Jongmah
  19. Project Euler Problem6
  20. JDK自带的运行监控工具JConsole观察分析Java程序的运行

热门文章

  1. MapReduce 简单的全文搜索2
  2. 阿里开源Mysql分布式中间件:Cobar
  3. ios 计算字符串长度<转>
  4. iOS开发 调用系统相机和相册 分类: ios技术 2015-03-30 15:52 65人阅读 评论(0) 收藏
  5. C语言-if语句
  6. bzoj3809
  7. dubbo框架揭秘之服务发布
  8. Bagging和Boosting 概念及区别
  9. ksoap2- webservice
  10. Win10還原成最乾淨的狀態 不必重灌