I get following error message when trying to insert an object in the database:
尝试在数据库中插入对象时,我收到以下错误消息:
com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException:
DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=2,
TABLEID=19, COLNO=0, DRIVER=4.15.134
How can I retrieve the table/column name for which the error is thrown?
如何检索引发错误的表/列名称?
1 个解决方案
#1
11
Apparently at the package level, DB2 only works with the IDs and not the names.
显然,在包级别,DB2只使用ID而不是名称。
You can find them back using the following query:
您可以使用以下查询找回它们:
SELECT C.TABSCHEMA, C.TABNAME, C.COLNAME
FROM SYSCAT.TABLES AS T,
SYSCAT.COLUMNS AS C
WHERE T.TBSPACEID = 2
AND T.TABLEID = 19
AND C.COLNO = 0
AND C.TABSCHEMA = T.TABSCHEMA
AND C.TABNAME = T.TABNAME
#1
11
Apparently at the package level, DB2 only works with the IDs and not the names.
显然,在包级别,DB2只使用ID而不是名称。
You can find them back using the following query:
您可以使用以下查询找回它们:
SELECT C.TABSCHEMA, C.TABNAME, C.COLNAME
FROM SYSCAT.TABLES AS T,
SYSCAT.COLUMNS AS C
WHERE T.TBSPACEID = 2
AND T.TABLEID = 19
AND C.COLNO = 0
AND C.TABSCHEMA = T.TABSCHEMA
AND C.TABNAME = T.TABNAME