Hello Perl community,
here is a question I encountered dbi and till now I use brute force to
solve it, but I figured I may see better way to do it here.
in orable sqlplus If I do
select * from table, it will print out the results nicely, all
aligned.
in dbi what I do now
my $body = sprintf("market_symbol last info_volume best_bid
best_bid_size best_ask best_ask_size info_open info_low info_high
\n");
while ($hash_ref = $sth->fetchrow_hashref) {
$body = $body.sprintf("%13s", $hash_ref->{'MARKET_SYMBOL'});
$body = $body.sprintf("%7s", $hash_ref->{'LAST'});
$body = $body.sprintf("%12s", $hash_ref->{'INFO_VOLUME'});
$body = $body.sprintf("%9s", $hash_ref->{'BEST_BID'});
$body = $body.sprintf("%13s", $hash_ref->{'BEST_BID_SIZE'});
$body = $body.sprintf("%10s", $hash_ref->{'BEST_ASK'});
$body = $body.sprintf("%14s", $hash_ref->{'BEST_ASK_SIZE'});
$body = $body.sprintf("%10s", $hash_ref->{'INFO_OPEN'});
$body = $body.sprintf("%9s", $hash_ref->{'INFO_LOW'});
$body = $body.sprintf("%10s", $hash_ref->{'INFO_HIGH'});
$body = $body.sprintf("\n");
}
I have to figure out the column width by counting them one by one, is
there some way to use dbi and print out results nicely without doing
so?
Thank you and have a nice Thx givin!
Jim
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/