I’m connecting Java to Oracle database, everything’s is going pretty okay, except the following problem:
This works okay when I write the whole string within one couple of quotes:
String command =
"SELECT FIRST_NAME, PHONE_NUMBER, SALARY FROM EMPLOYEES WHERE SALARY < 5000";
BUT as the one above doesn’t look well-designed code I wanted to split the lines:
String command = new StringBuilder(
"SELECT FIRST_NAME, PHONE_NUMBER, SALARY\n")
.append("FROM EMPLOYEES\n")
.append("WHERE SALARY < 5000;")
.toString();
And meanwhile, I tried plus (+) instead of StringBuilder, but again messed up…
Please help((
Using StringBuilder.append() for a constant value is less efficient than writing the constant directly: