You might want to investige import and export capabilities of your DBMSs for example, if Ingres can dump to CSV, MySQL can easily import it with the LOAD command.

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); } }

In reply to Re: Copy tables from one db to another by jZed
in thread Copy tables from one db to another by Syst

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.