I am trying to debug performance issues with a perl file that runs a snippet of code similar to psuedo code like below. This script is running on a Unix machine with a db connection to a local Oracle 11.2.0 database.

my $sth1 = $localDB->prepare("< Some select query that returns mor +e 100000 records (1 column) >"); my $sth2 = $localDB->prepare("< Inner select query that uses the v +alues (id) from the previous sql >"); $sth1->execute(); my ($id); $sth1->bind_columns( undef, \$id); while ( $sth1->fetch() ) { ... $sth2->execute($id); my $dblinkname; while (($dblinkname) = $sth2->fetchrow_array()) { my $dblink_sql = "<Innermost select query that dynamically + creates a sql query with $dblinkname>"); E.G. <select * from table@dblinkname;> eval { my $dblink_sth = $localDB->prepare($dblink_sql); <-- +INV CURSOR HERE $dblink_sth->execute($id); <-- +EXECUTE FAILED HERE ... $dblink_sth->finish(); }; if ($@) { <log errors> next; } } ... $sth2->finish(); ... } $sth1->finish();

There are some machines that do not exist and executing the dblink query for those sql statements would throw the database not reachable error. However, every time I run the perl file the prepare statement marked above throws an invalid cursor (ORA-01001: invalid cursor) error and some times the execute statement right below throws an execute failed (DBD::Oracle::st fetchrow_array failed: ERROR no statement executing). I am currently at a loss on how to troubleshoot this script. Any pointers would be greatly appreciated.


In reply to Oracle Db Link Error ORA-01001: invalid cursor by mediocremorsov

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.