title: Using CURRENT TIME in an insert with a select in DB2
body: <p>I'm using JDBC to insert a single row into a DB2 database table using the insert-select style insert. I am simultaneously trying to insert dynamic data from a variable, as well as the <code>ENTRY_DATE</code> using <code>CURRENT DATE</code>:</p>
  
  <pre><code>INSERT INTO mytable (COL_A, COL_B, ENTRY_DATE)
  SELECT COL_A, ?, CURRENT DATE FROM mytable
  WHERE COL_A &gt; 1;
  </code></pre>
  
  <p>I'm new to sql and JDBC, so I don't know if using <code>CURRENT DATE</code> is common, or specific to our system, but it works in a normal insert like:</p>
  
  <pre><code>INSERT INTO mytable ENTRY_DATE values(CURRENT DATE);
  </code></pre>
  
  <p>I've never used insert-select style inserts, so I don't know if the error is on my '?' which I insert using PreparedStatement.setString, or the <code>CURRENT DATE</code> parameter. However I get the following error:</p>
  
  <blockquote>
    <p>[BEA][DB2 JDBC Driver][DB2]STRING TO BE PREPARED CONTAINS INVALID USE
    OF PARAMETER MARKERS</p>
  </blockquote>
  
  <p>Do I need to surround either or both of those with something to show they aren't part of the select statement? Do I need to rearrange my statement?</p>
  
  <p>EDIT:</p>
  
  <p>I can't show you my exact code, but here is a close aproximation:</p>
  
  <pre><code>String sql = null;
  PreparedStatement prepStmnt = null;
  Connection conn = getConnection("database");
  sql = "INSERT INTO MYTABLE ";
  sql += "(COLUMN_A, COLUMN_B, ENTRY_DATE)";
  sql += "SELECT COLUMN_A, ?, CURRENT DATE";
  sql += "FROM MYTABLE WHERE COLUMN_A &gt; 1;";
  prepStmnt = conn.prepareStatement(sql);
  prepStmnt.setString(1, myVar);
  prepStmnt.execute();
  </code></pre>