Hello all,

I ran into a little problem using fetchrow_hashref:

use strict;

$sth = $dbh->prepare(qq{ SELECT ID,
                         DECODE(NAME,NULL,'NONE',NAME) 
                         FROM $table});
  
$sth->execute();
my(%hash) = %{$sth->fetchrow_hashref('NAME_lc')};
$sth->finish;
  
Now the keys for %hash are 'ID' and 'DECODE(NAME,NULL,'NONE',NAME)'. Not
ideal on the latter. I worked around the problem with the following
(Oracle) statement:

$sth = $dbh->prepare(qq{ SELECT ID,
                                DECODE(NAME,NULL,'NONE',NAME) AS NAME
                                FROM $table});


I thought it might be good to include this in the mail archives for
reference.

Regards,

        Stacy.

Reply via email to