in reply to How to Fetch records from Oracle DB view
foreach my $m(0..$#row1)
If not, you should indicate since you haven't given us 52 lines of code. In the above, $#row1 is the last index of @row1, which you don't define. Since you want the last index of the array referenced by $row1, you mean
foreach my $m(0..$#$row1)
Note the extra sigil (and see perlref and/or perlreftut). A less error prone way of writing that block assuming you don't need the index would be using a foreach loop on the array itself:
foreach my $record (@$row1) { $data_file.= $record->{'ROW_DATA'} . "\n"; }
Update: You are also accessing the array reference improperly in the line
$data_file.= "$row1[$m]{'ROW_DATA'}\n";
which should be
$data_file.= "$row1->[$m]{'ROW_DATA'}\n";
since you need to dereference that reference to access its contents. You should probably (re)read perlreftut to gain insight into how references work in Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to Fetch records from Oracle DB view
by Rocko19 (Acolyte) on Sep 04, 2009 at 07:19 UTC | |
by afoken (Chancellor) on Sep 04, 2009 at 13:49 UTC | |
by kennethk (Abbot) on Sep 04, 2009 at 14:35 UTC |