java.sql.sqlexception ora-00904 oracle 10 g中的无效标识符

时间:2013-03-14 07:51:12

标签: java-ee

ps=con.prepareStatement("update customer set  customerId=?,customerName =?,Add1=? where customerd="+str1);

ps.setString(1,str1);
ps.setString(2,str2);
ps.setString(3,str3);

int j=ps.executeUpdate();

我收到此错误。提交这些代码。

2 个答案:

答案 0 :(得分:1)

如果您仔细阅读查询,您会发现customerd中有错字(我失踪了)。我建议你在将数据库放入代码之前在数据库客户端上运行任何查询,以找出这些类型的简单错误。

同样,where条件中的值可能需要在单引号之间,再次,您可以在数据库客户端中测试是否在java之外运行查询。

答案 1 :(得分:0)

对你有帮助吗?

否则尝试这样做:

update customer set  customerId=?,customerName ='?',Add1='?' where customerd= '"+str1+"'"

即添加额外的' '靠近你的str1和?。

希望对你有所帮助!

相关问题