PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Raja Sambamurty" <rajags at hotmail dot com>
Subject: any way to get the # of columns returned
Date: Nov 3 1997 3:38PM

Hi,

Using sybperl, I very often do the following

@retarr = $dbfh->sql ("select * from table");

Now I can do a print $#retarr to find out the number of rows returned, 
but what I need to know is the number of columns. The reason I need to 
know this is to do a print stmt as in

print "$retarr[0][1]\n";
               ^^^^

to determine how far to go with the subscripts. Is there a better way of 
doing this ? I guess I could always work around with a 

foreach $i (0..$#retarr) {
 my $j=0;
 while ( defined $retarr[$i][$j] ) {
    print "$retarr[$i][$j]";
    $j++;
 }
 print "\n";
}

Raja

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com