Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Loads a list of existing oracle tables and their block size to a hash. Ask user for a table, lookup block from the hash, convert block to mb.
# 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=y +ourpassword;"); $TableList->Sql("select TABLE_NAME, BLOCKS from USER_TABLES where tabl +e_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 = <STDIN>; chomp $tabnam; # # $tnam = $TabNam{$tabnam}; #lookup _ta +ble 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"; } # #

In reply to Oracle Hash by ccallahanwise

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 23:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found