in reply to Copy tables from one db to another
If you go the manual method, you can use something like this:
my $ingres_dbh = DBI->connect( @ingres_connection_args ); my $mysql_dbh = DBI->connect( @mysql_connection_args ); my @sql = ( { select => 'SELECT f1,f2,f3 FROM master_table_1' , insert => 'INSERT INTO back_table_2(f1,f2,f3) VALUES(?,?,?)' } , { select => 'SELECT abc1,abc2,abc3 FROM master_table_2' , insert => 'INSERT INTO back_table_2(abc1,abc2,abc3) VALUES(?,?,? +)' } ); for( 0..1 ){ my $select = $ingres_dbh->prepare( $sql[$_]->{select} ); my $insert = $mysql_dbh->prepare( $sql[$_]->{insert} );, while(my $row = $select->fetch){ $insert->execute(@$row); } }
|
|---|