title: ORA-01810: format code appears twice : jdbctemplate
body: <p>I am checking some dates and query's with jdbctemplate and i am getting the below error. </p>
  
  <pre><code>// creating a LocalDate object with specific date &amp; time   
  
  LocalDate date = LocalDate.of(LocalDate.now().getYear(), LocalDate.now().getMonth(), LocalDate.now().getDayOfMonth());
  
  System.out.println("date $$$$$$$$$$$" +date);
  
  LocalDateTime datetime = date.atTime(LocalTime.MAX);
  System.out.println("datetime " +datetime);
  
  // is not required since above steps is the same. 
  datetime.withHour(23).withMinute(59).withSecond(59);
  
  System.out.println("datetime with " +datetime);
  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh24:mm:ss");
  System.out.println("formatter" +datetime.format(formatter));
  
  
   return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM test where status in ('ACTIVE','ACTIVE_P') AND CREATED&lt;TO_dATE('"+datetime.format(formatter)+"','yyyy-MM-dd hh24:mm:ss')",Integer.class);
  </code></pre>
  
  <p>this is the output </p>
  
  <pre><code>date $$$$$$$$$$$2017-08-20
  datetime 2017-08-20T23:59:59.999999999
  datetime with 2017-08-20T23:59:59.999999999
  formatter2017-08-20 1124:59:59
  2017-08-20 01:53:00.029  INFO 12604 --- [pool-1-thread-1] com.zaxxer.hikari.HikariDataSource       : hikari-subscription - Started.
  2017-08-20 01:53:00.034  WARN 12604 --- [pool-1-thread-1] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was not found, trying direct instantiation.
  2017-08-20 01:53:00.949  INFO 12604 --- [pool-1-thread-1] com.zaxxer.hikari.pool.PoolBase          : hikari-subscription - Driver does not support get/set network timeout for connections. (oracle.jdbc.driver.T4CConnection.getNetworkTimeout()I)
  2017-08-20 01:53:02.190  INFO 12604 --- [pool-1-thread-1] o.s.b.f.xml.XmlBeanDefinitionReader      : Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
  2017-08-20 01:53:02.274  INFO 12604 --- [pool-1-thread-1] o.s.jdbc.support.SQLErrorCodesFactory    : SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]
  2017-08-20 01:53:02.283 ERROR 12604 --- [pool-1-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task.
  
  org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [SELECT COUNT(*) FROM test where status in ('ACTIVE','ACTIVE_P') AND CREATED&lt;TO_dATE('2017-08-20 1124:59:59','yyyy-MM-dd hh24:mm:ss')]; ORA-01810: format code appears twice
  ; nested exception is java.sql.SQLDataException: ORA-01810: format code appears twice
  
      at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:82) ~[spring-jdbc-4.3.10.RELEASE.jar:4.3.10.RELEASE]
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) ~[spring-jdbc-4.3.10.RELEASE.jar:4.3.10.RELEASE]
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) ~[spring-jdbc-4.3.10.RELEASE.jar:4.3.10.RELEASE]
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:419) ~[spring-jdbc-4.3.10.RELEASE.jar:4.3.10.RELEASE]
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:474) ~[spring-jdbc-4.3.10.RELEASE.jar:4.3.10.RELEASE]
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:484) ~[spring-jdbc-4.3.10.RELEASE.jar:4.3.10.RELEASE]
      at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:494) ~[spring-jdbc-4.3.10.RELEASE.jar:4.3.10.RELEASE]
      at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:500) ~[spring-jdbc-4.3.10.RELEASE.jar:4.3.10.RELEASE]
  </code></pre>
  
  <p>I see that in the logs the query gets printed as </p>
  
  <pre><code>AND CREATED&lt;TO_dATE('2017-08-20 1124:59:59','yyyy-MM-dd hh24:mm:ss')
  </code></pre>
  
  <p>1124, I think that is the problem but whatever I do, I am not able to remove that 11.</p>