Reputation: 15
I get error ERROR: syntax error at or near "("
String deleteSQL = "DELETE FROM customer" +
"WHERE (fname = 'Fred' AND lname = 'Flintstone')" +
"OR (fname = 'Barney' AND lname = 'Rubble')";
System.out.println("Records deleted: "
+ stmt.executeUpdate(deleteSQL));
Upvotes: 1
Views: 110
Reputation: 11002
String deleteSQL = "DELETE FROM customer " +
"WHERE (fname = 'Fred' AND lname = 'Flintstone') " +
"OR (fname = 'Barney' AND lname = 'Rubble') ";
System.out.println("Records deleted: "
+ stmt.executeUpdate(deleteSQL));
The problem are the missing spaces while concatinating.
Imagine the following:
"word" + "word2"
this would result "wordword2"
so it should be
"word" + " " + "word2"
or "word "+ "word2"
Upvotes: 5