I am trying to implement an Oracle database comparison script, using the DBIx::Compare::Oracle module.
In the script below, when I un-comment this section, I get no results in the hash
my $hashref = $oDB_Comparison->get_differences;
print Dumper \$hashref;
And when I just call to
my @aList = $oDB_Comparison->get_tables;
I get the following error:
DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement (DBD
+ERROR: OCIStmtExecute) [for Statement "show tables"] at C:/Perl/site/
+lib/DBIx/Compare.pm line 544. DBD::Oracle::st bind_columns failed: St
+atement has no result columns to bind (perhaps you need to successful
+ly call execute first) [for Statement "show tables"] at C:/Perl/site/
+lib/DBIx/Compare.pm line 545. DBD::Oracle::st fetch failed: ERROR no
+statement executing (perhaps you need to call execute first) [for Sta
+tement "show tables"] at C:/Perl/site/lib/DBIx/Compare.pm line 546.
+DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement (DBD
+ ERROR: OCIStmtExecute) [for Statement "show tables"] at C:/Perl/site
+/lib/DBIx/Compare.pm line 544. DBD::Oracle::st bind_columns failed: S
+tatement has no result columns to bind (perhaps you need to successfu
+lly call execute first) [for Statement "show tables"] at C:/Perl/site
+/libDBIx/Compar
e.pm line 545. DBD::Oracle::st fetch failed: ERROR no statement execu
+ting (perhaps you need to call execute fir
st) [for Statement "show tables"] at C:/Perl/site/lib/DBIx/Compare.pm
+line 546.
I re-installed DBIx::Compare, and I did not see in the documentation where I have to do an execute statement before calling 'get_tables'.
Any/all help would be greatly appreciated! Thank you!
T.j.
Entire script:
#!/usr/bin/perl
use strict;
use warnings;
use DBIx::Compare::Oracle;
use DBI; # database module
use DBD::Oracle qw(:ora_types); # database module for oracle
use sys_utils; # custom utilities
use Data::Dumper; # robust print output mechanism
# load the database code into the new working directory
my ( $usr1, $pwd1 ) = getUsrPwdBuildAutomation('MMAD09');
my $DBH1 = DBI->connect( "dbi:Oracle:$SID", $usr1, $pwd1 )
|| die "Error Connecting to \$dbh1: " . $DBI::errstr . "\n";
my ($usr2, $pwd2 ) = getUsrPwdBuildAutomation('MMAD02');
my $DBH2 = DBI->connect( "dbi:Oracle:$SID", $usr2, $pwd2 )
|| die "Error Connecting to \$dbh1: " . $DBI::errstr . "\n";
# test connection
my $sth = $DBH2->prepare('SELECT sysdate from dual');
$sth->execute();
while ( my @row = $sth->fetchrow_array() ) {
foreach (@row) {
$_ = "\t" if !defined($_);
print "$_\t";
}
print "\n";
}
my $oDB_Comparison = db_comparison->new( $DBH1, $DBH2 );
$oDB_Comparison->verbose;
my @aList = $oDB_Comparison->get_tables;
#my $hashref = $oDB_Comparison->get_differences;
#print Dumper \$hashref;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.