title: PHP: oci_bind_by_name and timestamp field results in "ORA-01461: can bind a LONG value only for insert into a LONG column"
body: <p>I have an Oracle database and need to insert a string with a date in YYYY-MM-DD HH:MM:SS format into an Oracle timestamp field. For this I have written this code:</p>
  
  <pre><code>$date = '2013-01-01 10:10:10';
  $sql = oci_parse($c,"INSERT INTO MY_TABLE (ID, SEND_DATE) VALUES (MY_SEQ.nextval, TO_TIMESTAMP(:send_date, 'YYYY-MM-DD HH24:MI:SS'))");
  oci_bind_by_name($sql, ':send_date', $date, null, SQLT_CHR);
  oci_execute($sql);
  </code></pre>
  
  <p>The table looks like this:</p>
  
  <pre><code>CREATE TABLE "MY_TABLE" 
  (   "ID" NUMBER NOT NULL ENABLE, 
      "SEND_DATE" TIMESTAMP (0) NOT NULL ENABLE );
  </code></pre>
  
  <p>If I execute the query above, I get this error:</p>
  
  <blockquote>
    <p>ORA-01461: can bind a LONG value only for insert into a LONG column</p>
  </blockquote>
  
  <p>There are already tons of questions regarding ORA-01461 on Stack Overflow, yet I could not find a solution for this particular problem. I really cannot understand where in this constellation LONG comes in.</p>