I have a date expression in a scalar like this:

$mydate = q!timestamp 'today' - interval '30 days'!;

I want to execute a statement like this:

$stmt = $dbh->prepare('SELECT * FROM foo WHERE date_added > ?');
$stmt->execute($mydate);

DBD::Pg reports that the date is invalid. But if I change this to

$stmt = $dbh->prepare("SELECT * FROM foo WHERE date_added > $mydate");

it's fine. What am I missing here?

-- 
Jeff Boes                                             vox 616.226.9550
Database Engineer                                     fax 616.349.9076
Nexcerpt, Inc.                                      [EMAIL PROTECTED]

Reply via email to