in reply to Re: DBI and fetchall_arrayref (gosh!)
in thread DBI and fetchall_arrayref (gosh!)

Hi Michael. Yes there is an average function in Oracle, but the form of my SQL statement would take the form:
$sth = $dbh->prepare(qq{ SELECT avg(DECODE(cat1, -1,null,cat1)), . . . avg(DECODE(cat15, -1,null,cat15)) FROM TABLE });
The reason for this monster: well entries in columns can be '-1' (indicating the category was not applicable at entry time). So in order to get statistics, I have to change the -1's to nulls - that way Oracle doesn't include the nulls in the AVG calculations.... Regards, Stacy.