我收到错误 ERROR: 在“(”处或附近出现语法错误
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));
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));
问题是连接时缺少空格。
想象一下:
“单词”+“单词2”
这将导致 "wordword2"
所以应该是
"word" + " " + "word2"
或者 "word "+ "word2"