title: "Literal does not match the format string" error
body: <p>When I try to execute the below code it gives me an <code>java.sql.SQLException: ORA-01861: literal does not match format string</code> error.  </p>
  
  <p>I am trying to copy some of the column values from <code>customer1_details</code> table to <code>customer2_details</code> table. The columns datatype which I am trying to move is <code>TIMESTAMP(6)</code> for <code>TIME_REGISTERED</code>, <code>DATE_DISCHARGED</code> columns and the datatype for <code>DATE_OF_BIRTH</code> column is <code>DATE</code></p>
  
  <pre><code>    try
      {
          Connection conn=Address.getOracleConnection();  
          int id = 1;     
          Date dob = null;
          Timestamp timereg = null,datedischarged = null;
  
          Statement stmt=conn.createStatement();
          ResultSet res=stmt.executeQuery("SELECT TIME_REGISTERED,DATE_DISCHARGED,DATE_OF_BIRTH from customer1_details WHERE customer_id = '"+id+"' ");
               if(res.next())
               {      
                   timereg=res.getTimestamp("TIME_REGISTERED");           
                   datedischarged=res.getTimestamp("DATE_DISCHARGED"); 
                   dob=res.getDate("DATE_OF_BIRTH");     
               }              
  
              String sql1="INSERT INTO customer2_details(TIME_REGISTERED_3,DATE_DISCHARGED_3,DATE_OF_BIRTH,customer_ID) "
      + "VALUES('"+timereg+"','"+datedischarged+"','"+dob+"','"+id+"') ";
  
          PreparedStatement pst=conn.prepareStatement(sql1);
          pst.executeUpdate();
          pst.close();       
          conn.close();
      }
      catch(Exception e)
      {            System.out.print(e);           }  
  </code></pre>
  
  <p>It will be more helpful if anyone provides the answer <code>without using INSERT INTO ... SELECT ... statement</code>.</p>