Working with an Oracle database, there are several ways to fetch rows from table.  In 
terms of performance which best?  Here is a snippet from an existing script, are there 
ways to improve it?
 
...
my $sql = qq { SELECT a.duns_num, b.name, c.last_upd, c.start_dt, c.end_dt FROM 
$schema.s_org_ext a, $schema.s_org_ext b,
$schema.s_quote_soln c
WHERE c.serv_accnt_id = b.row_id AND c.inv_accnt_id = a.row_id AND c.action_cd = 
'EnergyServices'
AND c.last_upd >= ? AND c.last_upd < ? $id
ORDER BY c.start_dt};
my $sth = $dbh->prepare($sql);
my $rc = $sth->execute($strt,$end);
my $aref = $sth->fetchall_arrayref({});
foreach (@$aref) {
$$_{STARTTIME} = $$_{START_DT};
$$_{STOPTIME} = $$_{END_DT};
$$_{STATUS} = 'A';
}
return($aref);

Would an ref cursor be better?

Thanks.

Reply via email to