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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |