Connection is working properly. i am able to insert rows but getting exception (SQLException: ORA-00933: SQL command not properly ended ) in updating the table , using following code.( BOX_ID is integer ,rest are varchar)
连接正常。我可以使用以下代码插入行但在更新表时获得异常(SQLException:ORA-00933:SQL命令未正确结束)。(BOX_ID是整数,其余是varchar)
PreparedStatement p_statement2=connection.prepareStatement("UPDATE TOYS_TABLE SET NAME= ? VENDOR=? LABLE=? WHERE NAME=? AND BOX_ID=?");
p_statement2.setString(1, "abc1");
p_statement2.setString(2, "abc2");
p_statement2.setString(3, "abc3");
p_statement2.setString(4, "XYZ123");
p_statement2.setInt(5,11);
try
{
p_statement2.executeUpdate();
p_statement2.close();
}
catch(Exception kl)
{
kl.toString();
p_statement2.close();
}
2 个解决方案
#1
1
change this
改变这一点
UPDATE TOYS_TABLE SET NAME= ? VENDOR=? LABLE=? WHERE NAME=? AND BOX_ID=?
to
至
UPDATE TOYS_TABLE SET NAME= ?, VENDOR=? , LABLE=?, WHERE NAME=? AND BOX_ID=?
#2
1
You have syntax error on your UPDATE
statement. You should delimited each column with a comma.
您的UPDATE语句有语法错误。您应该用逗号分隔每列。
UPDATE TOYS_TABLE
SET NAME=?,
VENDOR=?,
LABLE=?
WHERE NAME=? AND BOX_ID=?
#1
1
change this
改变这一点
UPDATE TOYS_TABLE SET NAME= ? VENDOR=? LABLE=? WHERE NAME=? AND BOX_ID=?
to
至
UPDATE TOYS_TABLE SET NAME= ?, VENDOR=? , LABLE=?, WHERE NAME=? AND BOX_ID=?
#2
1
You have syntax error on your UPDATE
statement. You should delimited each column with a comma.
您的UPDATE语句有语法错误。您应该用逗号分隔每列。
UPDATE TOYS_TABLE
SET NAME=?,
VENDOR=?,
LABLE=?
WHERE NAME=? AND BOX_ID=?