Subject: | Cannot use dates in placeholders |
DBD::ODBC doesn't deal with dates in placeholders correctly. I have
searched the web and found a few inconclusive reports of such behaviour.
I have tried binding the datatype to the column but no joy.
I have tried to find 1.14 in ppm format, but no luck on AS's repo nor
uwinnipeg. There is a 1.14 available at trouchelle.com, but ppm doesn't
know what to do with it.
Just for reference the following program may be called with two dates on
the command line. Only the second date will be inserted into the table.
(The db() routine just something that returns a DBD::ODBC connection).
(Note that the dates are formatted in the same way. In my case, this is
DD/MM/YYYY. The fact that the do() works means that the underlying
database can parse the format correctly).
The error returned is:
DBD::ODBC::st execute failed: [Oracle][ODBC]Datetime field overflow.
(SQL-22008) [Oracle][ODBC]General error.
(SQL-HY000)(DBD:st_execute/SQLExecute err=-1) at date-insert.pl line 22.
The code:
use strict;
use warnings;
use DBI ':sql_types';
use MyDV 'db';
my $db = db(); # a valid DBI handle
END { $db->commit }
$db->do(<<END_SQL);
create table dl (
d date
)
END_SQL
my $put = $db->prepare(<<END_SQL) or die "prepare put\n", $db->errstr;
insert into dl (d) values (?)
END_SQL
$put->bind_param(1, undef, SQL_DATE);
my $r = $put->execute($ARGV[0]);
$db->do("insert into dl (d) values ('$ARGV[1]')") or die $db->errstr;
__END__
Hopefully this is fixed in 1.14. If not, if you need any help in
tracking this down, just holler.
Regards,
David Landgren