I have an sql statement which works fine in the psql client:

delete from sessions where current_timestamp - time > interval '00:02:00';

but when I try it using DBI, it produces this error:

 DBD::Pg::st execute failed: execute called with an unbound
 placeholder ...


That part of the code is like this:

 my $dbh = DBI->connect($dsn, $user, $password,
                       { RaiseError => 1, AutoCommit => 0 });

 . . .

 my $interval = '00:20:00';

 my $sth = $dbh->prepare("delete from sessions where \
 current_timestamp - time > interval ?");

 $sth->execute( $interval );


What mistake is there causing the error?  I can use a similar line with
a placeholder for a SELECT sql statement without error.

Regards,
/Lars

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to