Hello,

My goal is to copy data in one MySQL table ($bard) to one Oracle table ($pics). I believe that all but one of my lines of code are near enough okay to be okay.

$mysql_db = DBI->connect("DBI:mysql:database=$d;host=$h", $u, $) $oracle_db = DBI->connect("dbi:Oracle:host=$h;service_name=$d", $u, $p +) $mysql_db->{RaiseError} = 1; $oracle_db->{RaiseError} = 1; # get data from MySQL $sql = ' select bmprefix, bmid, englishtitle, foreigntitle from mysql_books '; $sql_handle = $mysql_db->prepare($sql); $sql_handle->execute(); $mysql_data = $sql_handle->fetchall_arrayref(); # revise Oracle table $del_sql = " delete from bard_books where bkmed = '?' and bkseq = ? "; $ins_sql = " insert into oracle_books (bkmed, bkseq, english_title, foreign_title) values ('?', ?, '?', '?') "; $del_handle = $oracle_db->prepare($del_sql); $ins_handle = $oracle_db->prepare($ins_sql);

I have a hard time with references and how to use them. It's hard to get my head around these. So this next and last statement is probably really wrong. How do i want to correct this?

$tuples = $del_handle->execute_array(\%attr, $mysql_data) or die $del_handle->errstr;

Several existing threads on perlmonks address my issue. They point to cpan modules outside DBI that are cool but a tiny bit unstable, such as DBIx::Copy.

Please accept thanks for whatever assistance or advice you're able to share.


In reply to Copying a Database Table Using DBI's execute_array by plendid

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.