我尝试将我的 java 应用程序中的值和 table1 中的值插入到 table2 中。我收到以下错误(db2 z/os):
Exception in thread "main" com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: DB2 SQL Error: SQLCODE=-803, SQLSTATE=23505, SQLERRMC=1;DB2T.TSOZ360_WV_AUSGANG, DRIVER=3.66.46
PreparedStatement _prep = con.prepareStatement("INSERT INTO DB2T.TABLE2 (column1, column2, column3 , column4, column5, column6) SELECT ?, ?, ?, ?, column5, column6 FROM DB2T.TABLE1 WHERE column1 = ? column2 = ? AND column3 = ?");
_prep.setString(1,"HELLO");
_prep.setString(2,"H");
_prep.setString(3,"1234567890");
_prep.setString(4,"Hsdfdsffdssdfsdfd");
_prep.setLong(5,9876543210l);
_prep.setInt(6,1);
_prep.setInt(7,12345678);
Table1:
column1, column2, column3 , column4, column5, column6
Table2
column1, column2, column3 , column4, column5, column6
所以我想将我在java应用程序中生成的值插入TABLE2和TABLE1中的两个值。无需将这两个值导入应用程序。我做错了什么?