Hi,

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_

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.