Hi Ashish,

If you get the results using a hash reference rather than just an array of
values then you can:
(not tested...)

my $row = $stmt->fetchrow_hashref(); # returns a reference to a hash indexed
by column name

foreach my $column (keys %{$row}) {

  print "$column: " . $results->{$column} . "\n";

}

will print "columnname: value" for each field returned for a given row.

Mark

-----Original Message-----
From: ashish srivastava [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 30, 2004 1:48 PM
To: [EMAIL PROTECTED]
Subject: DBI Question

Hi
Is it possible to get the names of the columns which a user has selected? I
mean suppose a user writes a query as :
select ename,deptno,sal from emp;
then can we print the column name(ENAME,DEPTNO,SAL) ?
Thanks
Ashish
 
 



 



Easiest Money Transfer to India. Send Money To 6000 Indian Towns. 
This message contains confidential and potentially legally privileged
information solely for its intended recipients and others may not
distribute, copy or use it. If you have received this communication in
error, please tell us by return email and delete it, and any copies of it.

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to