I am trying to execute the following script:
#!/usr/bin/perl -w use strict; use DBI; my $db = "Pg"; my $db_database = "whatever"; my $user = "whatever"; my $password = "whatever"; my $dbh = DBI->connect("dbi:$db:dbname=$db_database", $user, $password); my $query = $dbh->prepare (q{SELECT arrival_date - INTERVAL '? MINUTE' FROM emails LIMIT 1}) or die ("unable to prepare"); $query->execute(60) or die("unable to execute"); print $query->fetchrow_array, "\n";
(arrival_name has this format: timestamp with time zone NOT NULL by default CURRENT_TIMESTAMP)
The problem is that the location of the question mark was not found, because its internal single quotes:
DBD::Pg::st execute failed: called with 1 bind variables when 0 are needed
This does not help if I use qq {}, $ 1 placeholder and tried several options with $ dbh-> quote. How can I do this job?
atlau source share