title: Building a more efficient SQL insert with StringBuffer
body: <p>I'm working on a project and I've created a method <code>insertStatement()</code> which creates a string buffer that structures my SQL insert statement. Here it is: </p>
  
  <pre><code>private String insertStatement() {
  
      StringBuffer sb = new StringBuffer(
              "insert into CUSTOMER (NAME, NUMBER, CITY, STATE) values (");
      sb.append("'" + this.custName + "',");
      sb.append("'" + this.custNum + "',");
      sb.append("'" + this.custCity + "',");
      sb.append("'" + this.custState + ")");
      return sb.toString();
  }
  </code></pre>
  
  <p>I'm wondering if there is a more efficient way of building this statement without having to append each line with a <code>'</code> at the start and a <code>',</code> at the end.</p>
  
  <p>Some more detail for the question. I am creating a batch job and this method is returning the statement as a String which will then populate an Array List that will be passed to an ItemWriter, which then stores the data into the database. </p>