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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|