OK. this loop is mystifying me. I have placed prints (actually a sub I have to kill and send the errors to the browser) all throughout the script. The variables all seem to be defined correctly, it does everything its supposed to do - i.e. all the entries get made in the database, i can even cut it off at the second to last itteration and get the output up to that point. something goes haywire on the last time through and this thing just hangs. it sits there until i kill it. all the entires are in the database correctly and everything is fine from the flow of what should happen, it just never returns any results. it's running under use strict; and -w and, even if you think the code is bad :), it had been working.

I'm stumped. The very last line of the code down there is the sub which takes the message and sends a page with that as the header. It never gets there. I have done everything i can think of to debug this - I have been working on it all day. any ideas at all are appreciated. feel free to -- away because I know how lame this is.

while (my @people = $sth->fetchrow_array()) { my $person = join ",", @people; push @certified_people, $person; } $sth->finish; $sth = $dbh->prepare('SELECT TEMP_CLICK_ID.NEXTVAL FROM DUAL') or dienice("199 Couldn't prepare statement: " . $dbh->errstr); $sth->execute() or dienice("202 Couldn't execute statement: " . $sth->errstr); while ( my @results = $sth->fetchrow_array()) {$click_id = $result +s[0]; chomp $click_id;} $sth->finish; print qq!$javascript_to_select_names_screen_two!; foreach my $certified_person (@certified_people) { my ($fname,$lname,$sc_id) = split ",", $certified_person; ## Prepare the SQL to get the conflicts # What we do is test to see if either the start or end of any +appointment falls between the start # and end of the proposed appointment. my $CONFLICT_STATEMENT = q!SELECT SC_BASE_APPT.CALL_ID, SC_BAS +E_APPT.STATUS FROM SC_BASE_APPT , SC_BASE_INFO WHERE ( (SC_BASE_INFO.TRANS_ID = S +C_BASE_APPT.TRANS_ID) ) AND SC_BASE_APPT.SC_ID = ? AND ((to_number(SC_BASE_INFO.AP_START) + <= ? AND to_number(SC_BASE_INFO.AP_END) >= ?) OR (to_number(SC_BASE_INFO.AP_START) +<= ? AND to_number(SC_BASE_INFO.AP_END) >= ?)) !; my $sth = $dbh->prepare($CONFLICT_STATEMENT) or dienice("230 Couldn't prepare statement: $CONFLICT_STATEMEN +T" . $dbh->errstr); # now concatenate the values into start and end times my $start_time = sprintf"%02d%02d%02d%02d%02d", $SMONTH,$SDA +Y,$SYEAR,$SHOUR,$SMINUTE; my $start_day = sprintf"%02d%02d%02d", $SMONTH,$SDA +Y,$SYEAR; my $end_time = sprintf"%02d%02d%02d%02d%02d", $EMONTH,$EDA +Y,$EYEAR,$EHOUR,$EMINUTE; my $end_day = sprintf"%02d%02d%02d", $EMONTH,$EDA +Y,$EYEAR; $sth->execute($sc_id,$start_time,$start_time,$end_time,$end_ti +me) or dienice("241 Couldn't execute statement: " . $sth->errstr); if ( $sth->fetchrow_array() ) { next; } $sth->finish; # if we get this far, put in temp records my ($trans_id, $call_id); +#, @returns); my $appt_classes_ref = \%appt_classes; #@returns = makeTempRec($click_id, $sc_id, $start_time, $end_t +ime, $appt_classes_ref); #($trans_id, $call_id) = @returns; { my ($status, @cols, @vals); # connect to database my $dbh = DBI->connect( $CONNECT, $USERNAME, $PASSWORD ) or dienice("336 Cant connect to Oracle database: $DBI::err +str\n"); my $getTransId = $dbh->prepare('SELECT MAKE_APPT.NEXTVAL F +ROM DUAL') or dienice("251 Couldn't prepare statement: " . $dbh->errs +tr); $getTransId->execute() or dienice("254 Couldn't execute statement: " . $getTransI +d->errstr); while ( my @results = $getTransId->fetchrow_array()) { $tr +ans_id = $results[0]; } $getTransId->finish; my $getCallId = $dbh->prepare('SELECT CALL_ID.NEXTVAL FROM + DUAL') or dienice("341 Couldn't prepare statement: " . $dbh->errs +tr); $getCallId->execute() or dienice("344 Couldn't execute statement: " . $getCallId +->errstr); while ( my @results = $getCallId->fetchrow_array()) { $cal +l_id = $results[0]; } $getCallId->finish; $status = "SCHEDULING"; # you need to insert temp records in the different appt ta +bles my $TRANS_ID_TEMP_RECORD = qq! INSERT INTO SC_TRANS_ID ( TRANS_ID, CLICK_ID ) VALUES +( $trans_id, $click_id ) !; my $BASE_INFO_TEMP_RECORD = qq! INSERT INTO SC_BASE_INFO ( TRANS_ID, CONTACT, REP_EMAIL, ADD_ST, ADD_CITY, ADD_ +STATE, ADD_ZIP, ADD_FLOOR, CONT_PHN, AP_START, AP_END, COMPANY, CON_EMAIL ) VALUES ( $trans_id, 'contact name', 'email here', 'War +renville Rd.', 'Naperville', 'IL', 999999999, 'floor', 8003069329, '$start_time', '$end_time', 'placeholder', 'jsander\@q +uest.com' ) !; my $BASE_APPT_TEMP_RECORD = qq! INSERT INTO SC_BASE_APPT ( TRANS_ID, CALL_ID, SC_ID, STATUS ) VALUES ( $trans_id, $call_id, $sc_id, '$status' ) !; # the APPT_CLASSES record must be built push @cols, "CALL_ID"; push @vals, "$call_id"; foreach my $key ( keys %{$appt_classes_ref} ) { push @cols, $key; if (not ref $appt_classes_ref->{$key}) { push @vals, $appt_classes_ref->{$key}; } else { push @vals, scalar( join ",", @{$appt_clas +ses_ref->{$key}} ); } } my $CLASSES_RECORD; $CLASSES_RECORD = 'INSERT INTO SC_APPT_CLASSES (' ; $CLASSES_RECORD .= (join ",", @cols) ; $CLASSES_RECORD .= ') VALUES (' ; $CLASSES_RECORD .= (join ",", map {if ($_ !~ /^\d+$/) {spr +intf "'%s'", $_; } else { sprintf "$_"; } } @vals) ; $CLASSES_RECORD .= ')'; $dbh->do("$TRANS_ID_TEMP_RECORD") or dienice("320 Couldn't execute statement: $TRANS_ID_TEMP +_RECORD" . $dbh->errstr); $dbh->do("$BASE_INFO_TEMP_RECORD") or dienice("320 Couldn't execute statement: $BASE_INFO_TEM +P_RECORD" . $dbh->errstr); $dbh->do("$BASE_APPT_TEMP_RECORD") or dienice("320 Couldn't execute statement: $BASE_APPT_TEM +P_RECORD" . $dbh->errstr); $dbh->do("$CLASSES_RECORD") or dienice("320 Couldn't execute statement: $CLASSES_RECOR +D" . $dbh->errstr); #my @returns = ($trans_id, $call_id); #return @returns; } push @temp_call_ids, $call_id; push @temp_trans_ids, $trans_id; print qq!<OPTION VALUE="$sc_id,$fname,$lname">$fname $lname</O +PTION>\n!; $dummies++; } dienice("defined @temp_call_ids and @temp_trans_ids");

"sometimes when you make a request for the head you don't
want the big, fat body...don't you go snickering."
                                         -- Nathan Torkington UoP2K a.k.a gnat


In reply to loop not ending... by jptxs

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.