#!/usr/bin/perl -w use DBI; $dbh = DBI->connect("dbi:Oracle:XXXX","XXXXXX","XXXX", { AutoCommit => 0, RaiseError => 1, PrintError => 1 }) or die "can't connect to database:", $DBI::errstr, "\n"; $sth = $dbh->prepare("select 'IC_STAGE', t.table_name, column_name from user_tables t, user_tab_columns c where c.table_name = t.table_name AND t.table_name = 'AC_SHIPMENT' AND column_name in ('ACT_DELIVERY_TSP', 'CONS_NATL_ACCT_NBR', 'PICKUP_UNIT_ID')"); $sth->execute(); while (@row = $sth ->fetchrow_array()) { push @ListoTabCols, [@row]; } $dbh ->disconnect(); print "disconnected\n"; for $i ( 0 .. $#ListoTabCols ) { print "reconnecting\n"; $dbh = DBI->connect("dbi:Oracle:XXXX","XXXX","XXXX", { AutoCommit => 0, RaiseError => 1, PrintError => 1 }) or die "can't connect to database:", $DBI::errstr, "\n"; $prow = $ListoTabCols[$i]; print "row $i : $prow->[0] $prow->[1] $prow->[2]\n"; @returno = $dbh->selectrow_array("select min($prow->[2]) from $prow->[1]"); $dbh ->disconnect(); print "disconnected\n"; # HERE IS THE INSERT INTO THE HASH ************* print "returned value: $returno[0]\n"; %Profileshoh = ($prow->[0] => { $prow->[1]=>{ $prow->[2]=>{ MIN_VALUE=>$returno[0] } } }) } while ( ($schemata, $tablas) = each %Profileshoh ) { print "$schemata: "; while ( ($tabla, $colums) = each %$tablas ) { print "$tabla: "; while ( ($colum, $measures) = each %$colums ) { print "$colum: "; while ( ($measure, $value) = each %$measures ) { print "$measure = $value "; } } } print "\n"; } exit;