# use Win32::ODBC; # # Load a list of Existing Tables and their Block size to a Hash # # $TableList = new Win32::ODBC("DSN=databasename; UID=yourlogonid; PWD=yourpassword;"); $TableList->Sql("select TABLE_NAME, BLOCKS from USER_TABLES where table_name like 'PS_%'"); while ( $TableList->FetchRow() ) { %hash= $TableList->DataHash(); $tabnam = $hash{TABLE_NAME}; $blocks = $hash{BLOCKS}; $TabNam{$tabnam} = $tabnam; $Blocks{$tabnam} = $blocks; $errcd = $TableList->Error(); # print "$tabnam", "\n", "$errcd"; }; $TableList->Close(); foreach $key (keys %TabNam) { print "given $key we get $Blocks{$key}\n"}; # # # print "please enter table name\n"; $tabnam = ; chomp $tabnam; # # $tnam = $TabNam{$tabnam}; #lookup _table if (!$tnam) { #table doesnt exist } else { #get table blocks $Blks = $Blocks{$tnam}; $mbyte = (($Blks * 8192)/1048576); ($mb, $dummy) = split(/\./,(($mbyte))); if ($mb < 1) {$mb = 1;} print "TableName: $tnam Blocks: $Blks MB: $mb"; } # #