title: MERGE JDBCTemplate issue
body: <p>I know my questions is similar to this question : <a href="https://stackoverflow.com/questions/4589647/update-on-insert-duplicate-primary-key-in-oracle">UPDATE on INSERT duplicate primary key in Oracle?</a></p>
  
  <p>actually exact copy.</p>
  
  <p>I am new to spring framework. so this is my first attempt. I have tried ,many examples but failed miserably. </p>
  
  <p>So here is the thing. </p>
  
  <p>My source and target is the same.what i want is to update the record if its in the Db otherwise insert. </p>
  
  <p>i am using the following method. My insert query is working fine. But when i use MERGE. i am getting errors.</p>
  
  <pre><code>public void insertAllPointss(final List&lt;AllPoints&gt; allpoints) {
  
  
  //      String sql = "INSERT INTO myTable " +
  //                  "(WIFI_SEQ_NO, my_urlL, street_number, house_number, street_name, last_update) VALUES (seq_w.NEXTVAL, ?, ?, ?, ?, ?) ";
  
           String sql = "MERGE INTO myTable M" +
                    " USING (SELECT ? AS my_urlL, ? AS street_number, ? AS house_number,? AS street_name, ? AS last_update FROM dual) N"+
                      "  ON (M.street_number = N.street_number AND M.house_number = N.house_number AND M.street_name = N.street_name)"+
                    " WHEN MATCHED THEN UPDATE SET M.last_update = N.last_update"+
                    " WHEN NOT MATCHED THEN INSERT(WIFI_SEQ_NO, my_urlL, street_number, house_number, street_name, last_update)"+
                                         "  VALUES(seq_w.NEXTVAL, N.my_urlL, N.street_number, N.house_number, N.street_name, N.last_update)";
  
            getJdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter() {
  
                Calendar calendar = Calendar.getInstance();
                java.sql.Date ourJavaDateObject = new java.sql.Date(calendar.getTime().getTime());
              @Override
              public void setValues(PreparedStatement ps, int i) throws SQLException {
                  AllPoints allpoints = AllPointss.get(i);
                  ps.setString(1, AllPoints.getWebsite());
                  ps.setDouble(2, allpoints.getStreetNumber());
                  ps.setDouble(3, allpoints.getHouseNumber());
                  ps.setString(4, allpoints.getStreetName());
                  ps.setDate(5, ourJavaDateObject);
              }
  
              @Override
              public int getBatchSize() {
                  return AllPointss.size();
              }
            });
  
  
          }
  </code></pre>
  
  <p>following is my log file</p>
  
  <pre><code>[7/18/17 8:24:00:952 CST] 00000043 com.ibm.ws.rsadapter.spi.DatabaseHelper                      I DSRA8203I: Database product name : H2
  [7/18/17 8:24:00:952 CST] 00000042 com.ibm.ws.rsadapter.spi.DatabaseHelper                      I DSRA8203I: Database product name : H2
  [7/18/17 8:24:00:952 CST] 00000043 com.ibm.ws.rsadapter.spi.DatabaseHelper                      I DSRA8204I: Database product version : 1.4.195 (2017-04-23)
  [7/18/17 8:24:00:952 CST] 00000042 com.ibm.ws.rsadapter.spi.DatabaseHelper                      I DSRA8204I: Database product version : 1.4.195 (2017-04-23)
  [7/18/17 8:24:00:952 CST] 00000043 com.ibm.ws.rsadapter.spi.DatabaseHelper                      I DSRA8205I: JDBC driver name  : H2 JDBC Driver
  [7/18/17 8:24:00:952 CST] 00000042 com.ibm.ws.rsadapter.spi.DatabaseHelper                      I DSRA8205I: JDBC driver name  : H2 JDBC Driver
  [7/18/17 8:24:00:952 CST] 00000043 com.ibm.ws.rsadapter.spi.DatabaseHelper                      I DSRA8206I: JDBC driver version  : 1.4.195 (2017-04-23)
  [7/18/17 8:24:00:952 CST] 00000042 com.ibm.ws.rsadapter.spi.DatabaseHelper                      I DSRA8206I: JDBC driver version  : 1.4.195 (2017-04-23)
  [7/18/17 8:24:01:108 CST] 00000042 SystemErr                                                    R Exception in thread "SimpleAsyncTaskExecutor-1" 
  [7/18/17 8:24:01:108 CST] 00000043 SystemErr                                                    R Exception in thread "SimpleAsyncTaskExecutor-2" 
  [7/18/17 8:24:01:108 CST] 00000043 SystemErr                                                    R org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [MERGE INTO myTable M USING (SELECT ? AS my_urlL, ? AS street_number, ? AS house_number,? AS street_name, ? AS last_update FROM dual) N  ON (M.street_number = N.street_number AND M.house_number = N.house_number AND M.street_name = N.street_name) WHEN MATCHED THEN UPDATE SET M.last_update = N.last_update WHEN NOT MATCHED THEN INSERT(WIFI_SEQ_NO, my_urlL, street_number, house_number, street_name, last_update) VALUES(seq_w.NEXTVAL, N.my_urlL, N.street_number, N.house_number, N.street_name, N.last_update)
  </code></pre>
  
  <p>i feel there is a problem my MERGE SQL STATEMENT, i am looking for some help/guidance</p>