Hello All, In production there are two tables Facebook_321 and Facebook_321_ext Facebook_321:

id_code: 862012249 entry_time: 2016-10-28 23:36:08 parent_id_code: 783924049_861760507288022 author_name: Lia+nik+son author_code: 1294333813357 author_url: https://www.facebook.com/120357 author_image_url: http://graph.facebook.com/17/picture entry_url: https://business.facebook.com/28262849 entry_types: COMMENT status_code: MOD entry_text: +so%2C++it%27s+the+home+team%21 entry_data: false,"can_comment":false} last_update: 0000-00-00 00:00:00 pull_time: 2016-11-16 18:53:40 queue_code: NULL
Facebook_321_ext:
id_code: 281938224734_10154342971729735 item_name: pull_run_id item_value: 1480804468 item_data: NULL

I have been making queries against a set of tables based on time, but now there are many Facebook_321_ext tables that don't have a time column so I am basically querying the facebook_321 table based on time getting id_codes and storing them.But I am not sure I am doing it correctly, because I am getting an error

DBD::mysql::st fetchrow_array failed: fetch() without execute() at /ho +me/rdscopy.pl line 199. DBD::mysql::st fetchrow_array failed: fetch() without execute() at /ho +me/rdscopy.pl line 199

I dont think I am handling multiple data correctly, can I get some help please? Thank you

#get Id_Codes based on entry time my $feed_table_ext_idcode = $dbh2->prepare("SELECT id_code FROM $fee +d_table WHERE entry_time >= ?"); $feed_table_ext_idcode->execute($time); my $feed_table_ext_results = $dbh2->prepare("SELECT * from $feed_ta +ble_ext WHERE id_code = ?"); while (my @row = $feed_table_ext_idcode->fetchrow_array()) { #print "@row\n"; $feed_table_ext_results->execute(@row); }

My reasoning for the above code is that , there are many id_codes and data returned and I want to store those and insert them into another DB in staging.

Returned after querying facebook_321_ext table in production and need +to copy them to staging ************************** 24. row *************************** id_code: 281938224734_10154342971729735 item_name: PRE_MOD_Krttime item_value: 1480804542 item_data: NULL *************************** 25. row *************************** id_code: 281gfg154342971729735 item_name: PRE_MOD_SetQueue item_value: UNKNOWN item_data: NULL *************************** 26. row *************************** id_code: 281938224734_101gf29735 item_name: PRE_MOD_SetQueue_time item_value: 1480804587 item_data: NULL *************************** 27. row *************************** id_code: 281938224734_10154342971729735 item_name: PRE_MOD_Textalfggtect item_value: POSITIVE item_data: NULL *************************** 28. row *************************** id_code: 281938224734_10154342971729735 item_name: PRE_MOD_TgfentDetect_time item_value: 1480804573 item_data: NULL *************************** 29. row *************************** id_code: 281938224734_10154342971729735 item_name: pull_run_id item_value: 1480804468 item_data: NULL *************************** 30. row *************************** id_code: 281938224734_10154342971729735 item_name: pugfme item_value: 1480804471 item_data: NULL
So $feed_table_ext_results has the query, then @row will have all the id_code and information I need execute based on each id_code which would be done by $feed_table_ext_results->execute(@row);

My insert statement for staging would be below

my $ext_insert = $dbh3->prepare("INSERT IGNORE INTO $feed_table_ext (i +d_code, item_name, item_value, item_data) VALUES (?, ?, ?, ?)") or di +e $dbh3->errstr; while (my @insert_ext = $feed_table_ext_results->fetchrow_array()) { $ext_insert->exe +cute(@insert_ext) or die $sth_insert->errstr; }

In reply to Perl DBI execute statement by cbtshare

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.