sarve
sarve

Reputation: 1

java.sql.sqlexception ora-00904 invalid identifier in oracle 10 g

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();

i am getting this Error.while submitting these code.

Upvotes: 0

Views: 19591

Answers (2)

Medet Koilybay
Medet Koilybay

Reputation: 111

Does it help you?

Otherwise try to do this one:

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

i.e add extra ' ' near your str1 and ?.

Hope that will help you!

Upvotes: 1

Augusto
Augusto

Reputation: 29837

if you read the query carefully, you'll see that you have a typo in customerd (missing I). I would suggest you to run any query on a database client before putting it in your code, to figure our these types of simple errors.

Also the value in the where condition probably needs to be between single quotes, which again, you can test if you run the query outside java, in the database client.

Upvotes: 2

Related Questions