# establish database connection my $dsn = "dbi:Oracle:DWAPRD"; my $dbh = DBI->connect($dsn, $user, $pass); # execute "lov_table_lookup.sql" my $sth = $dbh->prepare($lov_table_sql); $sth->execute($note_filter, $name_filter); # print returned data and store table numbers in array my @table_numbers; print "\n----------\n"; while(my $row = $sth->fetchrow_hashref()) { print $row->{'TABLE_NUMBER'}, " ", $row->{'GLOBAL_SECTION_NAME'}, " ", $row->{'NOTE'}, "\n"; push(@table_numbers, $row->{'TABLE_NUMBER'}); } print "----------\n"; # retrieve and print lov value list for each table number found foreach(@table_numbers) { my $row_counter = 1; # execute "lov_value_lookup.sql" my $sth = $dbh->prepare($lov_value_sql); $sth->execute($_); print "\n----------\n"; while(my $row = $sth->fetchrow_hashref()) { print "$row_counter ", $row->{'TABLE_NUMBER'}, " ", $row->{'LOV_INTEGER_KEY'}, " ", $row->{'LOV_DISPLAY_KEY'}, " ", #$row->{'NOTE'}, "\n"; $row_counter++; } print "----------\n"; }