GBase 8s
适配迁移
文章
删除表记录时,报“692: Key value for constraint ( 主键约束名称 ) is still being referenced.”
发表于2023-04-23 15:22:52211次浏览0个评论
问题描述:
删除表记录时,报“692: Key value for constraint ( 主键约束名称 ) is still being referenced.”
解决方案:
删除的记录被外键引用了,故不能删除,如果需要删除该记录,应当先删除外键所在表的该值所有记录,以下语句可获取外键参考所在的表的名称:
select t.tabname
from sysconstraints c, systables t, sysreferences r
where c.tabid = t.tabid
and c.constrid = r.constrid
and c.constrtype = 'R'
and r.ptabid = (select tabid from systables where tabname = '主键表名');
评论已关闭
热门帖子
- 12025-12-01浏览数:182759
- 22023-05-09浏览数:25044
- 42023-09-25浏览数:18519
- 52020-05-11浏览数:17526