I found an error either in the documentation or in the code. According to the examples from the DBD :: Oracle documentation, it is allowed to { use ora_type => ORA_NUMBER } in the bind_param call. But actually it does not work as expected. One need to fix either the documentation or the code.
Below is a very simple test that shows what is happening.
use strict; use warnings;
use DBI;
use DBD::Oracle qw/:ora_types/;
my $dbh = DBI->connect('DBI:Oracle:odb2', 'scott', 'tiger'
, {PrintError => 1, AutoCommit => 1, RaiseError => 1, PrintWarn => 1});
my $stmt = $dbh->prepare("select dump(:num) from dual");
$stmt->bind_param(':num', 1234567890, { ora_type => ORA_NUMBER });
$stmt->execute;
print $stmt->fetch->[0], "\n\n";
$stmt = $dbh->prepare("select :num + 1 from dual");
$stmt->bind_param(':num', 1234567890, { ora_type => ORA_NUMBER });
$stmt->execute;
print $stmt->fetch->[0], "\n\n";
$stmt = $dbh->prepare("select :num + 1 from dual");
$stmt->bind_param(':num', 1234567890, { ora_type => SQLT_INT });
$stmt->execute;
print $stmt->fetch->[0], "\n\n";
I found an error either in the documentation or in the code. According to the examples from the DBD :: Oracle documentation, it is allowed to { use ora_type => ORA_NUMBER } in the bind_param call. But actually it does not work as expected. One need to fix either the documentation or the code.
Below is a very simple test that shows what is happening.