Get the second line of an error message from Oracle db in perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jonathan184
    New Member
    • Nov 2006
    • 154

    Get the second line of an error message from Oracle db in perl

    This is part of the perl script.

    Basically i want to try and get the second line of the error message.
    Now the whole error which is 5 lines long will come up if i use $Errormsg
    So basically i just want the second line of $errormsg to print is this possible?

    Code:
    select TRIM(ed.created_date) Created_Date,
               TRIM(ed.ERRORMSG) ErrorMsg,
               to_char(substr(eventdata,instr(eventdata,'<ns0:SiteContractNumber>')+24,
                    instr(eventdata,'</ns0:SiteContractNumber>') - instr(eventdata,
                    '<ns0:SiteContractNumber>')-24)) SiteContractNumber,
    	   to_char(substr(eventdata,instr(eventdata,'<ns0:ContactNumber>')+19,
    	        instr(eventdata,'</ns0:ContactNumber>') - instr(eventdata,
    	        '<ns0:ContactNumber>')-19)) ContactNumber,
    	   to_char(substr(eventdata,instr(eventdata,'<ns0:LineItemNumber>')+20,
    	        instr(eventdata,'</ns0:peekaboo>') - instr(eventdata,
    	        '<ns0:peekaboo>')-20)) LineItemNumber
       from exception e, exception_detail ed
        where e.jmsid = ed.jmsid
          and trunc(e.timeoccured) = (sysdate)
          and (upper(projectname) like '%BOOBOODEE%')
                                                                  
    
    $sth = $hisCon->prepare( $zuluSQL);
    $sth->execute();
    
      
    while( $sth->fetch() ) {
     
          $sth->bind_columns(\$Created_Date, \$ErrorMsg, \$SiteContractNumber, \$ContactNumber, \$LineItemNumber);
       if ($SiteContractNumber != null) {    
           
          
       if ($ErrorMsg =~ /Data not found : Product Info -/) {
        
          $recLine = " ".$SiteContractNumber." ".$LineItemNumber."\t".$Created_Date."\t"."Product Not Found:  ";
          writeLogFile($logFile, $recLine .  "\n");}  
             
     else {
           $recLine = " ".$SiteContractNumber." ".$LineItemNumber."\t".$Created_Date."\t"."Site Contract Not Found:  ".$SiteContractNumber;
           writeLogFile($logFile, $recLine .  "\n"); }      
           }
     }
Working...