in reply to Re^4: Perl DBI execute statement
in thread Perl DBI execute statement

Where does this loop

while (my @row = $feed_table_ext_idcode->fetchrow_array()) { #print "@row\n"; $feed_table_ext_results->execute(@row); }

appear in relation to this loop ?

while (my @insert_ext = $feed_table_ext_results->fetchrow_array()){ #print "@insert_ext\n"; $ext_insert->execute(@insert_ext) ; }

I was expecting to see the second nested in the first

poj

Replies are listed 'Best First'.
Re^6: Perl DBI execute statement
by cbtshare (Monk) on Dec 14, 2016 at 01:16 UTC
    I have the sections grouped together that do fetching for the rows and then a section for the inserts .So the group of fetch calls for rows appear before the group of inserts. The solution was as HUCK presented . Thank you for your reply poj

      But unless you nest the 2 loops if this query returns multiple IDs

      my $feed_table_ext_idcode = $dbh2->prepare( "SELECT id_code FROM $feed_table WHERE entry_time >= ?"); $feed_table_ext_idcode->execute($time);

      then only records with the last ID will be selected/inserted in the second loop because the records with the other IDs will have been discarded in the first select loop.

      while (my @row = $feed_table_ext_idcode->fetchrow_array()) { #print "@row\n"; $feed_table_ext_results->execute(@row); }
      poj