Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ora_type => ORA_NUMBER #115

Open
NisSAM opened this issue May 18, 2020 · 1 comment
Open

use ora_type => ORA_NUMBER #115

NisSAM opened this issue May 18, 2020 · 1 comment

Comments

@NisSAM
Copy link

NisSAM commented May 18, 2020

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";
@djzort
Copy link
Collaborator

djzort commented May 20, 2020

Good bug report, thanks for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants