The data is dumped into an excel file and emailed to my email address. The data that is dumped into the spreadsheet is clearly correct. I am not sure what I need to validate. Secondly, I just ran the below logic...it works....When you fetch data and put it into an array. It does not index it. It is all placed in array index 0. I want to index the data. In terms of a data dump my code already does that....The data trace(2) says that it is keeping the first array. The emailed data says it is keeping the first array.

Can you pass an array index to a sql statement via a loop to get more specific data? That is all I want to know. Can sql passed an array indexed value with each iteration? That is my only question. If it can't be done that is fine... but The data structure has been dumped and validated. I know how to dump data and create and entance to view the data structure.

############################ # # Set the Perl Modules # ############################ use strict; use DBI; use Spreadsheet::WriteExcel::Big; use Mail::Sender; my $i = 0; my $j = 1; ################################## # # Connect to Oracle database. # ################################### my $connection = DBI->connect('dbi:Oracle:xxxxx','xxxxx','xxxxx',{ AutoCommit => 0, RaiseError => 1, PrintError => 1, }) || die "Database connection not made: $DBI::errstr"; ############################ # # Set up Query for Store # ############################ my $stmt_1 = "select alignment from rd_list"; ############################ # # Prepare Query # ############################ my $query = $connection->prepare($stmt_1); ############################ # # Execute Query # ############################ $query->execute() or die $connection->errstr; ############################### # # Declaration. # ############################### my ($alignment); ############################################ # # binds each column to a scalar reference # ############################################ $query->bind_columns(undef,\$alignment); ############################### # # Create Array_ref for array. # ############################### my $rows = $query->fetchall_arrayref; ############################### # # Load data in array. # ############################### foreach $i(0..$#{$rows}) { foreach $j (0..$#{$rows->[$i]} ) { $rows->[$i][$j]; } } my $num = $query->rows; print "\nThis process returns $num of Rd's.\n\n"; $query->finish(); $connection->rollback; $connection->disconnect();

In reply to Re^8: SQL query using dynamic array by cocl04
in thread SQL query using dynamic array by cocl04

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.