title: Date format returning ORA-00904 in java code but not in sql developer
body: <p>I am using spring JDBCTemplate to query my data.</p>
  
  <hr>
  
  <p>I have the following query in my code</p>
  
  <pre><code>static final String SQL = SELECT msgs.msg_submit_date MSG_DATE FROM {0}.messages msgs 
  WHERE TRUNC(msgs.msg_submit_date) 
  BETWEEN TO_DATE(:startDate,'YYYY-MM-DD') AND TO_DATE(:endDate,'YYYY-MM-DD') ;
  
  String formattedSQL = MessageFormat.format(SQL , new Object[] "sms.schema"});
  </code></pre>
  
  <p>and I am getting an <code>ORA-00904: "DD": invalid identifier</code> error when I run it. I am assuming this is because the <code>msg_submit_date</code> column has <code>HH:MI:SS</code> associated with it, however, I don't want to place <code>HH:MI:SS</code> in my java code. Having year, month and day will suffice.</p>
  
  <p>Also, when I run the same query, in my Oracle SQL Developer IDE, it runs fine without any errors so not sure what is going wrong.</p>
  
  <hr>
  
  <p>The date gets generated via <code>java.time.LocalDate</code> using the following format:</p>
  
  <pre><code>DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/d/yyyy");
  </code></pre>
  
  <p>which returns the following string format <code>2018-06-03</code>.</p>
  
  <p>The jdbc call:</p>
  
  <pre><code>jdbcTemplate.query(formattedSQL, params, new MessagesRowMapper())
  </code></pre>
  
  <hr>
  
  <p>I think it maybe due to <code>MessageFormat</code>.</p>