sybperl-l Archive

Help!
I must be missing something obvious....but I can't find anything
similar in the archive.
The desired result from the query below is a single row, with
MITD_ICD=1660 and the highest-valued MITD_PREFIX associated with
the 1660 ICA (prefixes are unique)
This sql code, when run directly in Sybase's isql, returns
the desired single row. However, when the sql is embedded into dbcmd
as shown in this script, the entire table is returned. The issue
appears to be the use of 'max(). If I want all rows with ICA=1660,
everything's fine, but adding the max criteria freaks out the script.
I've tried multiple variants of the sql, all of which work
when entered directly into Sybase, but return a cartesian
cross-product when entered via Sybperl. What am I
missing???
$SearchVal=shift;
$user=shift;
$pw=shift;
$server=shift;
$dbproc=new Sybase::DBlib($user, $pw, $server);
$dbproc->dbuse ('icabin');
$dbproc->{"dbNullIsUndef"}=TRUE;
$dbproc->dbcmd (<dbsqlexec != SUCCEED)
{print STDOUT "problem\n";}
$dbproc->dbresults;
while (@dat=$dbproc->dbnextrow)
{
print STDOUT "$dat[0], $dat[1] \n";
}
(note: code borrowed heavily from archive samples)
Beth
---------------------------------------------------
Beth Breidenbach
Consulting Systems Engineer - Applications
BankAmerica NW
bethb@ior.com
"A ship in port is safe, but
that is not what ships are for.
Sail out and do new things"
(Admiral Grace Hopper, Computer Pioneer)
---------------------------------------------------