如何解决 DB2 中的 SQL State = 23503 Native Error Code = -530?
我的应用程序正在执行插入查询,
insert into test.tab1
(NSALGNP,CCMOD,CMODTYP,CMODFTRYOPT,NFRMELVTH,NFRMSEQ,TCREATSTAMP,CPRF,CCIV,CSEX,NDLRBRN,NDLR,DPUR
,NEUSSTREET,XEUSFRTNAM,XEUSNAM,CLUPDUSER,TLUPDSTAMP,DBRTHDAY
,XSTREET2,XCITY,XCTRY,XPOST,XSTREET1,XTEL)
values
('217','WX10T','E1','','3','009389',current timestamp,'14','1','M','','999003','13.02.2021'
,'','ARMAND','JENNET','WINDEV',current timestamp,'01.01.0001'
,'','MOLAS','FR','31230','VILLAGE','');
以下是错误:
描述 = [IBM][CLI Driver][DB2] SQL0530N FOREIGN KEY "GFREU03" 的插入或更新值不等于父表的父键的任何值。 SQLSTATE=23503
SQL 状态 = 23503 本机错误代码 = -530
错误代码:22 级别:致命错误(EL_FATAL)
My Application is executing insert query
insert into test.tab1
(NSALGNP,CCMOD,CMODTYP,CMODFTRYOPT,NFRMELVTH,NFRMSEQ,TCREATSTAMP,CPRF,CCIV,CSEX,NDLRBRN,NDLR,DPUR
,NEUSSTREET,XEUSFRTNAM,XEUSNAM,CLUPDUSER,TLUPDSTAMP,DBRTHDAY
,XSTREET2,XCITY,XCTRY,XPOST,XSTREET1,XTEL)
values
('217','WX10T','E1','','3','009389',current timestamp,'14','1','M','','999003','13.02.2021'
,'','ARMAND','JENNET','WINDEV',current timestamp,'01.01.0001'
,'','MOLAS','FR','31230','VILLAGE','');
Below is the error:
Description = [IBM][CLI Driver][DB2] SQL0530N The insert or update value of the FOREIGN KEY "GFREU03" is not equal to any value of the parent key of the parent table. SQLSTATE=23503
SQL State = 23503
Native Error Code = -530
Error code: 22
Level: fatal error (EL_FATAL)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该对 主键、引用完整性、检查和唯一约束。
您的应用程序显然试图违反引用约束“GFREU03”。
以下声明可能会帮助您了解到底什么是违规的。
COLS_CHILD
是您尝试插入的表中的列(外键列)的列表。COLS_PARENT
是相应父表TABSCHEMA.TABNAME
中的列(主键列)列表。您指定的外键列中的一组值在父表的主键列中不存在。这就是您收到错误的原因。
解决方案是不要插入具有违反此类约束的值的行。
You should have basic understanding of Primary key, referential integrity, check, and unique constraints.
Your application tries to violate the referential constraint "GFREU03" obviously.
The following statement may help you to understand, what is violated exactly.
COLS_CHILD
is a list of columns (foreign key columns) in the table you tried to insert into.COLS_PARENT
is a list of columns (primary key columns) in the corresponding parent tableTABSCHEMA.TABNAME
.A set of values in the foreign key columns you specified doesn't exist in the primary key columns of the parent table. This is why you get the error.
The solution is not to insert rows with values violating such a constraint.