superfly2
2003-09-18 00:22:18 UTC
Hi, the while loop I use to print each result of my SQL query seems to stop
when it encounters the FIRST NULL value (although there are other non-NULL
values still left to be printed. How can I avoid this so that I print all
the non-NULL values? Thanks.
My code is as follows:
my $sthv=$dbh->prepare($queryv);
$sthv->execute();
Now, for every output value
while(my $val = $sthv->fetchrow())
{
print OUTPUT "$val\n";
}
It prints:
| Klk7 |
| D10Ucla1 |
| Whsc2h |
| Oaz2 |
Instead of (from a query done directly in SQL):
| Klk7 |
| D10Ucla1 |
| Whsc2h |
| Oaz2 |
| NULL |
| Slc25a2 |
| Slc25a15 |
| Hornerin-pending |
| NULL |
| D6Ucla1e |
| Odcp-pending |
| Whsc1l1 |
| Oaz3 |
| NULL |
| NULL |
| NULL |
| NULL |
| NULL
when it encounters the FIRST NULL value (although there are other non-NULL
values still left to be printed. How can I avoid this so that I print all
the non-NULL values? Thanks.
My code is as follows:
my $sthv=$dbh->prepare($queryv);
$sthv->execute();
Now, for every output value
while(my $val = $sthv->fetchrow())
{
print OUTPUT "$val\n";
}
It prints:
| Klk7 |
| D10Ucla1 |
| Whsc2h |
| Oaz2 |
Instead of (from a query done directly in SQL):
| Klk7 |
| D10Ucla1 |
| Whsc2h |
| Oaz2 |
| NULL |
| Slc25a2 |
| Slc25a15 |
| Hornerin-pending |
| NULL |
| D6Ucla1e |
| Odcp-pending |
| Whsc1l1 |
| Oaz3 |
| NULL |
| NULL |
| NULL |
| NULL |
| NULL