On Monday, August 4, 2003, at 6:56 AM, Stephen Collyer wrote:


Michael A Chase wrote:

The function must be in the prepared SQL, the values do not.  A common
example in Oracle is:

  $dbh -> {RaiseError} = 1;
  my $sth = $dbh -> prepare( join "\n",
     'INSERT INTO testtable ( dob, profession, age, name )',
     '   VALUES ( TO_DATE( ?, 'YYYY-MM-DD' ), ?, ?, ? )' );
END_SQL
  $sth -> execute( $date, $proffession, $age, $name );

OK, that makes sense, though it didn't occur to me immediately. Is this clear to all
but me ? A quick google didn't throw up any refs to this kind of question, so maybe
I'm just a little slow on the uptake.

It wasn't clear to me, and I'm definitely grateful for the code example. I've been converting perl's localtime into a SQL-ish date string and pushing that into the DB.


Mike Schienle



Reply via email to