title: H2 add/subtract Interval Second in Oracle Query
body: <p>I have h2 database in server mode for my tests.</p>
  
  <p>I can't add/subtract an interval to my date, in my spring-batch writer, when my request works in SQLDeveloper</p>
  
  <p>h2 config :</p>
  
  <pre><code>private DataSource createH2DataSource() {
      String jdbcUrl = String.format("jdbc:h2:%s/target/db/h2;AUTO_SERVER=TRUE;MODE=Oracle", System.getProperty("user.dir"));
      JdbcDataSource ds = new JdbcDataSource();
      ds.setURL(jdbcUrl);
      ds.setUser("sa");
      ds.setPassword("");
  
      return ds;
  }
  </code></pre>
  
  <p>liquibase :</p>
  
  <pre><code>&lt;column name="DATE_DEBUT_BI" type="TIMESTAMP" /&gt;
  &lt;column name="DATE_FIN_BI" type="TIMESTAMP" /&gt;
  </code></pre>
  
  <p>my request :</p>
  
  <pre><code>UPDATE MY_TABLE SET DATE_FIN_BI = :dateFinBi - INTERVAL '1' SECOND WHERE DATE_J = :dateJ AND CODE_EDE = :codeEde AND STATUT_EFFACEMENT = :statutEffacement
  </code></pre>
  
  <p>Error : </p>
  
  <pre><code>org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE MY_TABLE  SET DATE_FIN_BI = ? - INTERVAL '1' SECOND WHERE DATE_J = ? AND CODE_EDE = ? AND STATUT_EFFACEMENT = ?]; nested exception is org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "UPDATE MY_TABLE  SET DATE_FIN_BI = ? - INTERVAL '1'[*] SECOND WHERE DATE_J = ? AND CODE_EDE = ? AND STATUT_EFFACEMENT = ?"; SQL statement:
  UPDATE MY_TABLE  SET DATE_FIN_BI = ? - INTERVAL '1' SECOND WHERE DATE_J = ? AND CODE_EDE = ? AND STATUT_EFFACEMENT = ? [42000-196]
  at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
  at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
  at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:649)
  at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:662)
  at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:950)
  at org.springframework.jdbc.core.namedparam.NamedParameterBatchUpdateUtils.executeBatchUpdateWithNamedParameters(NamedParameterBatchUpdateUtils.java:40)
  ...
  Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "UPDATE MY_TABLE  SET DATE_FIN_BI = ? - INTERVAL '1'[*] SECOND WHERE DATE_J = ? AND CODE_EDE = ? AND STATUT_EFFACEMENT = ?"; SQL statement:
  UPDATE MY_TABLE  SET DATE_FIN_BI = ? - INTERVAL '1' SECOND WHERE DATE_J = ? AND CODE_EDE = ? AND STATUT_EFFACEMENT = ? [42000-196]
  at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
  at org.h2.message.DbException.get(DbException.java:179)
  at org.h2.message.DbException.get(DbException.java:155)
  at org.h2.message.DbException.getSyntaxError(DbException.java:191)
  at org.h2.command.Parser.getSyntaxError(Parser.java:534)
  at org.h2.command.Parser.prepareCommand(Parser.java:261)
  at org.h2.engine.Session.prepareLocal(Session.java:578)
  at org.h2.engine.Session.prepareCommand(Session.java:519)
  at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1204)
  at org.h2.jdbc.JdbcPreparedStatement.&lt;init&gt;(JdbcPreparedStatement.java:73)
  at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:288)
  at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1524)
  at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:627)
  ... 36 more
  </code></pre>
  
  <p>"Solution" :</p>
  
  <p>Thanks guys, so i extracted the subtract in java to have a simple query.</p>