引言
在一次数据库导入的操作中,由于数据是手动编造的,导致import到DB2数据库的时候发生了报错。
正文
SQL0803N One or more values in the insert statement,UPDATE statement,or foreign key update caused by a DELETE statement are not valid because the primary key ,unique constraint or unique index identified by "2" constrains table "xxx" from having duplicate rows for those columns.SQLSTATE=23505
以上错误一开始还以为是插入的主键与之前记录重复了导致,于是一一核对了主键,发现没有重复,后面查看了表结构,发现用了组合索引,一共有6个字段加了索引,其中有两个字段都是流水号,在生成数据的时候为了方便把这两个字段都用了循环的i变量,导致这两个字段重复了,所以报了这个错。