OS: Solaris 7
Perl: 5.6.0
DBI: 1.20
DBD::Oracle: 1.12

I've got a bit of a puzzle.  I'm making five repeated calls to a sub I
called "Get Simple Table".  It takes tables with a number and varchar2 field
and populates two array references so I can do lookups by id or by
description within the program without hitting the database multiple times.
Four out of five of the calls work great, one is giving me problems.  When I
execute the exact same SQL statement from SQLPlus, it returns the three rows
I would expect.

The first print statement is reporting "select * from BITS_USERSTATUS order
by ID", which works find from SQLPlus.  The find print is reporting 0 rows
read.

I know the data is in there, but my Perl code won't get it for me.  Does
anyone see anything odd about this (besides potential optimizations)?
-------------------------------
sub GetSimpleTable
{
        my ($href, $aref, $tablename) = @_;
        my $count=0;
        my $sth="";
        my $query="";
        my @row;
        my ($id, $desc);

        $query = "select * from $tablename order by ID";
        print STDERR "bits-oracle8i.pl: " . (caller 0)[3] . ": $query\n";
        $sth = $Bits::DBH->prepare($query);
        $sth->execute;

        while (@row = $sth->fetchrow_array) {
                $id = $row[0];
                $desc = $row[1];
                $href->{$desc} = $id;
                $aref->[$id] = $desc;
                ++$count;
        }

        $sth->finish;
        print STDERR "bits-oracle8i.pl: " . (caller 0)[3] . ": $count rows
read from $tablename\n";
        return($count);
}

Reply via email to