Sure no problem simple,
The code is too big and just his instance of it that is driving me crazy, but I can explain what the situation is.
I have some code that runs a query and returns a bunch of found account numbers and I use the following code
push @array_accnumber,$TOSUBACCOUNT
And inside of this "sub - &ACCOUNT" I have to run another query on each element of the array @array_accnumber, and at the end use RETURN to return the values found for each account number
$user = "myuser";
$pass = "mypass";
$dbh = DBI->connect("DBI:ODBC:MYDB",$user, $pass) || print "Connect to
+ MYDB fail: $!";
#Here the SQL will not contain the values. The values (@array_accnumbe
+r) are passed in during each execution.
#Instead of actually putting values in the sql,placeholders (?) are us
+ed instead.
#Then the statement can be reused a bunch of times with different data
+ sets.
#It has a number of advantages with regards to security, performance,
+and reusability.
my $p_str = join ',', ('?') x @array_accnumber;
print "<br><font color=navy><b>L 1437 - \$p_str - @array_claim</b></fo
+nt><br>";
$sql= "SELECT C58MASTER.CCLM, C58MASTER.CLIN FROM C58MASTER WHERE C58
+MASTER.CCLM IN ( $p_str ) AND C58MASTER.CLIN=$X_LINE ";
my $sth = $dbh->prepare( $sql );
$sth->execute( @array_claim )|| die $sth->errstr;
while (my $pointer = $sth->fetchrow_hashref){
#more code here...till I can use RETURN of the result data found...
}
$sth->finish;
#done
But instead this code is working very slow and I am trying to optimize it by doing something to improve speed when processing this sub routine.
Thank you, and I hope I explained better what I am looking for.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.