I have some code which should return ~5000 rows (2 columns) (as a reference to an array) from an Oracle database. To execute this PLSQL query takes ~1 second in TOAD or SQLDeveloper however in Perl, using the DBI and DBD::Oracle drivers, it takes just over half an hour. As far as I know, bind_columns is the most efficient way of retrieving data, but maybe you guys could suggest other ideas?
my $plsql=<<ENDPLSQL; DECLARE l_header pacProject.data_header_cur; l_data pacProject.data_cur; l_project_id NUMBER; l_design_set_id NUMBER; l_layout_id NUMBER; BEGIN l_design_set_id := NULL; l_layout_id := 1; pacProject.get_data( :l_project_id, l_design_set_id, l_layout_id, l_header, :l_data); END; ENDPLSQL my $sth_ideas = $dbh_ideas->prepare($plsql); my $sth2; my @row; $sth_ideas->bind_param(":l_project_id",$self->{project_id}); $sth_ideas->bind_param_inout(":l_data",\$sth2,0,{ora_type => ORA_R +SET}); $sth_ideas->execute; my $raRow; my $raResults = []; my ($id, $valreal, $valtext, $colorder); $sth2->bind_columns(\($id, $valreal, $valtext, $colorder)); while( $sth2->fetch ) { push @$raResults, [ $id,$valtext ]; } return $raResults;
Thanks.
Joe.
In reply to DBI Queries take half an hour by joec_
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |