Your code looks fine, but how do you connect to the database and run this script? Have you tried using Oracle 7.3 driver? Does it crash when connected via ODBC? Is it asynchronous or synchronous script? Is the connection asynchronous or synchronous (as specified in the database profile)? : The first time i run this script there is no error. If I rerun it i receive a : Dr. Watson error "Access violation..." : JAL script: // : ******************************************************************* : // Program: ChkCsiRj.JAL : // Description: Check rejected record for CSI and send email to constant : // recipient. : // Date: 2000-08-22 : // Autor: Pierre Dupuis : // : // Modification: // Date: // Autor: // : ******************************************************************* : // *** Constant *** : //Dim mail_recipient, string, "mtl_ecm_support_team" : Dim mail_recipient, string, "pierre_dupuis" : Dim database_name, string, "CSI Dev" : Dim sql_select,string, "select * from csi_loading_logs WHERE : NVL(total_nb_records,1) != NVL(nb_rejected_records,0) AND notice_ind = 0 : " : Dim sql_update,string, "update csi_loading_log set notice_ind=1 where id : = " : Dim message1,string, "The number of rejected records found: " : Dim subject,string, "CSI rejected record found" : Dim rows, number : Dim str_rows, string : Dim row_updated, number : Dim result, string : Dim empty, boolean : Dim update_err, boolean : Dim ind1, number : // Connect to database : DatabaseConnect( database_name ) : DatabaseRetrieve( sql_select, rows ) : IsEqual( rows, 0, empty ) : IfThen( empty, END ) : // Get id and update notice_ind : string (rows, str_rows) : ForNext(ind1,1,rows,1,END_LOOP) : DatabaseGet ind1,1,result : Concat sql_update,result,sql_update : DatabaseExecute sql_update, row_updated : IsEqual( row_updated, 0, update_err ) : If( update_err, UPDATE_ERROR, NO_ERROR ) : UPDATE_ERROR: messageBox("update error") : // Concat message1, str_rows, message1 : // MailSend "", "", mail_recipient, subject, message1 : NO_ERROR: END_LOOP: EMAIL: // send email alert : Concat message1, str_rows, message1 : // MailSend "", "", mail_recipient, subject, message1 : MessageBox(message1) : goto end : END: // Normal end : MessageBox("rien") : DatabaseDisconnect
|