I am trying to pull data out in a format. Well, heres my code:
my $dsn01 = "DBI:mysqlPP:$DB:ATABASE:$DB::SERVER";
my $dbh01 = DBI->connect($dsn01, $DB::REMOTE, $DB:ASS);
my $sth01 = $dbh01->prepare(qq{ SELECT id, old_id, firstname, mi, lastname, title FROM utl_rads ORDER BY old_id });
$sth01->execute();
while (($EXAM::ID, $EXAM::OLDID, $EXAMS::FIRSTNAME, $EXAMS::MI, $EXAMS::LASTNAME, $EXAMS::TITLE) = $sth01->fetchrow_array())
{
my $dsn02 = "DBI:mysqlPP:$DB:ATABASE:$DB::SERVER";
my $dbh02 = DBI->connect($dsn02, $DB::REMOTE, $DB:ASS);
my $sth02 = $dbh02->prepare(qq{ SELECT id, discription FROM sys_birads ORDER BY discription });
$sth02->execute();
while (($BIRAD::ID, $BIRAD:ES) = $sth02->fetchrow_array())
{
my $dsn03 = "DBI:mysqlPP:$DB:ATABASE:$DB::SERVER";
my $dbh03 = DBI->connect($dsn03, $DB::REMOTE, $DB:ASS);
my $sth03 = $dbh03->prepare(qq{ SELECT id, discription FROM sys_followup ORDER BY discription });
$sth03->execute();
while (($FOLLOWUP::ID, $FOLLOWUP:ES) = $sth03->fetchrow_array())
{
my $dsn04 = "DBI:mysqlPP:$DB:ATABASE:$DB::SERVER";
my $dbh04 = DBI->connect($dsn04, $DB::REMOTE, $DB:ASS);
my $sth04 = $dbh04->prepare(qq{ SELECT COUNT(*) FROM utl_exams WHERE rad = '$EXAM::OLDID' AND birad = '$BIRAD::ID' AND follow_up = '$FOLLOWUP::ID' AND exam_code != 'AR' AND exam_code != 'AV' AND exam_code != 'AB' AND exam_code != 'PM' });
$sth04->execute();
($RECORD::TOTAL01) = $sth04->fetchrow_array();
$sth04->finish();
$dbh04->disconnect();
&RECCOUNT;
}
$sth03->finish();
$dbh03->disconnect();
}
$sth02->finish();
$dbh02->disconnect();
if ($TOTAL::RECORDS ne '0') { $TABLE:ATA .= "<tr><td><br></td><td></td><td></td><td></td><td></td></tr>"; }
}
$sth01->finish();
$dbh01->disconnect();
The problem is that when i execute this it is s-l-o-w. Anything i can to to improve this?
Thanks for any suggestions!
- Scott
my $dsn01 = "DBI:mysqlPP:$DB:ATABASE:$DB::SERVER";
my $dbh01 = DBI->connect($dsn01, $DB::REMOTE, $DB:ASS);
my $sth01 = $dbh01->prepare(qq{ SELECT id, old_id, firstname, mi, lastname, title FROM utl_rads ORDER BY old_id });
$sth01->execute();
while (($EXAM::ID, $EXAM::OLDID, $EXAMS::FIRSTNAME, $EXAMS::MI, $EXAMS::LASTNAME, $EXAMS::TITLE) = $sth01->fetchrow_array())
{
my $dsn02 = "DBI:mysqlPP:$DB:ATABASE:$DB::SERVER";
my $dbh02 = DBI->connect($dsn02, $DB::REMOTE, $DB:ASS);
my $sth02 = $dbh02->prepare(qq{ SELECT id, discription FROM sys_birads ORDER BY discription });
$sth02->execute();
while (($BIRAD::ID, $BIRAD:ES) = $sth02->fetchrow_array())
{
my $dsn03 = "DBI:mysqlPP:$DB:ATABASE:$DB::SERVER";
my $dbh03 = DBI->connect($dsn03, $DB::REMOTE, $DB:ASS);
my $sth03 = $dbh03->prepare(qq{ SELECT id, discription FROM sys_followup ORDER BY discription });
$sth03->execute();
while (($FOLLOWUP::ID, $FOLLOWUP:ES) = $sth03->fetchrow_array())
{
my $dsn04 = "DBI:mysqlPP:$DB:ATABASE:$DB::SERVER";
my $dbh04 = DBI->connect($dsn04, $DB::REMOTE, $DB:ASS);
my $sth04 = $dbh04->prepare(qq{ SELECT COUNT(*) FROM utl_exams WHERE rad = '$EXAM::OLDID' AND birad = '$BIRAD::ID' AND follow_up = '$FOLLOWUP::ID' AND exam_code != 'AR' AND exam_code != 'AV' AND exam_code != 'AB' AND exam_code != 'PM' });
$sth04->execute();
($RECORD::TOTAL01) = $sth04->fetchrow_array();
$sth04->finish();
$dbh04->disconnect();
&RECCOUNT;
}
$sth03->finish();
$dbh03->disconnect();
}
$sth02->finish();
$dbh02->disconnect();
if ($TOTAL::RECORDS ne '0') { $TABLE:ATA .= "<tr><td><br></td><td></td><td></td><td></td><td></td></tr>"; }
}
$sth01->finish();
$dbh01->disconnect();
The problem is that when i execute this it is s-l-o-w. Anything i can to to improve this?
Thanks for any suggestions!
- Scott