in reply to Re^3: Database copy table with DBI
in thread Database copy table with DBI

thank you, I am however getting an error when using your method it always complains about the join statement

Use of uninitialized value $results14 in join or string at rdscopy.pl line 92. and I also get

DBD::mysql::st execute failed: Duplicate entry '10157236320140648_1015 +7237405105648' for key 'PRIMARY' at rdscopy.pl line 94. DBD::mysql::st execute failed: Duplicate entry '10157236320140648_1015 +7237405105648' for key 'PRIMARY' at rdscopy.pl line 94.

##print and insert at the same time while( my @results = $table_results->fetchrow_array()) { print join(",",@results); print "\n"; $sth_insert->execute(@results); }

But I do not get that duplicate error when I use the code below, do you know why? Its the same data

while (my $insert = $table_results->fetchrow_array()) { $sth_insert->execute(@$insert); }

Replies are listed 'Best First'.
Re^5: Database copy table with DBI
by choroba (Cardinal) on Nov 15, 2016 at 08:31 UTC
    > Its the same data

    Unless you use fetchrow_arrayref in the latter code, it's not the same data.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re^5: Database copy table with DBI
by poj (Abbot) on Nov 15, 2016 at 10:31 UTC
    I do not get that duplicate error when I use the code below, do you know why?

    Probably because you are not inserting any records having retrieved them all in the first while loop. What are the PrintError and RaiseError settings for the dbh2 handle ?

    poj
      performs basic automatic error reporting with DBI
        I think poj didn't ask what they are for, but what they are, i.e. "what values do they have in your script" concerning (a.k.a. "for") the $db2 handle?