timo has asked for the wisdom of the Perl Monks concerning the following question:
$sqlstr2 holds the query in question. Is there another way to do this without first creating a dblink in one of the databases? I'd like to be able to do this on any set of databases without creating the dblink.my $sqlstr ="select table_name". " from Dba_tables". " where owner = '$schema'". " order by table_name"; my $sth=$db1->prepare($sqlstr) or print STDOUT "Query:GetDataF +ast Failed"; $sth->execute; my $table_names = $sth->fetchall_arrayref; $sth->finish; for $table_names_r (@{$table_names}) { my $sqlstr ="select column_name". " from Dba_tab_columns". " where owner = '$schema'". " and table_name = '$table_names_r->[0]'". " order by column_name"; my $sth=$db1->prepare($sqlstr) or print STDOUT "Query:GetD +ataFast Failed"; $sth->execute; my $column_names = $sth->fetchall_arrayref; $sth->finish; my $sqlstr2 ="select *". " from $schema.$table_names_r->[0]". + " MINUS". " select *". " from $schema.$table_names_r->[0]".'@'."$confi +g{database_2}"; print STDOUT "Table: $schema.$table_names_r->[0]"; my $sth2=$db1->prepare($sqlstr2) or print STDOUT "Query:Ge +tDataFast Failed"; $sth2->execute; my $results = $sth2->fetchall_arrayref; $sth2->finish;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to Compare Data in 2 Separate Databases
by malloc (Pilgrim) on Nov 30, 2001 at 05:13 UTC | |
by hakkr (Chaplain) on Nov 30, 2001 at 15:20 UTC | |
|
Re: How to Compare Data in 2 Separate Databases
by gmax (Abbot) on Dec 04, 2001 at 17:56 UTC | |
|
Re: How to Compare Data in 2 Separate Databases
by wileykt (Acolyte) on Nov 30, 2001 at 22:46 UTC |