Two basic ways.  Either way, start with code like this:

my $dbh = DBI->connect('db:ODBC:dbname', 'username', 'password');
my $sql = 'SELECT * FROM Table1';
my $sth = $dbh->prepare($sql);
$sth->execute();

Method #1: The ->{NAME} attribute
=================================
while (my @row = $sth->fetchrow_array()) {
    my $field_number = $sth->{NUM_OF_FIELDS};
    my $fields = $sth->{NAME};
    foreach my $field (@$fields) {
         print "$field\n";
         }
    }

Method #2: ->fetchrow_hashref method
====================================
while (my $ref = $sth->fetchrow_hashref()) {
    foreach $key (keys(%$ref)) {
         print "$key\t$$ref{$key}\n";
         }
    }

Does that help?
Paul
    

Quoting Anthony Nickolayev <[EMAIL PROTECTED]>:

> Greetings. Maybe the answer for my question will be RTFM, but i still cant
> find
> it myself. The problem is: i need to fetch just list, contains column names -
> and
> i dont know how to do it. I didnt find it in DBI manual page, and anywhere
> else. 
> Thanks anyway, and sorry for my english.
> 




----------------------------------------
This mail sent through www.mywaterloo.ca

Reply via email to