[Pdx-pm] DBD::Oracle error
Christopher M. Hiller
chiller at eldorado.elsewhere.org
Mon Mar 17 17:01:01 CST 2003
Hi, I was wondering if someone here could give me a hand with this
problem. I have searched google, google groups and PerlMonks and have not
found anything worthwhile.
Here is some working code, albeit really slow:
---snip---
_walk($root);
sub _walk {
my $root = shift;
my $sql = qq{ SELECT prodcat_cd_for, prodcat_cd_in FROM
prod_cat_cmpnts WHERE prodcat_cd_for = :p_cat };
my $sth = $dbh->prepare($sql);
$sth->bind_param(':p_cat', $root);
$sth->execute;
while (my @row = $sth->fetchrow_array()) {
print "$row[1]\n";
_walk($row[1]);
}
}
---snip---
Here is what I'd like to do since I think it'd be quicker:
---snip---
my $sql = qq{ SELECT prodcat_cd_for, prodcat_cd_in FROM prod_cat_cmpnts
WHERE prodcat_cd_for = :p_cat };
my $sth = $dbh->prepare($sql);
_walk($root);
sub _walk {
my $root = shift;
$sth->bind_param(':p_cat', $root);
$sth->execute;
while (my @row = $sth->fetchrow_array()) {
print "$row[1]\n";
_walk($row[1]);
}
}
---snip---
However, Oracle returns the first row of the statement, then freaks:
DBD::Oracle::st fetchrow_array failed: ERROR no statement executing
(perhaps you need to call execute first)
What am I doing wrong? Do I need to prepare() when binding a new
parameter every time? Would this really make things quicker? The first
one is really quite slow...
Thanks for your help,
Chris
More information about the Pdx-pm-list
mailing list