Lets pretend for a moment the following code compiles:
BEGIN FOR seq IN (SELECT sequence FROM steven.test_table WHERE uid = seq.uid) LOOP SELECT DISTINCT b.desc, b.code INTO reason, cd FROM steven.test_table a, steven.test_map b WHERE a.uid = seq.uid; UPDATE steven.test_table SET reason = reason, cd = cd WHERE uid = seq.uid; END LOOP; COMMIT; EXCEPTION WHEN NO_DATA_FOUND THEN -- We ignore this error. NULL; WHEN OTHERS THEN err_num := SQLCODE; err_msg := SQLERRM; catch_error (procedure_name , err_num , err_msg , dos.do_uid , NULL , 'Too many rows found'); END;
The problem is when I actually use this code, if I encounter a NO_DATA_FOUND error the program still drops into the OTHERS exception block and catches the error. Why??
Having the same block of code with two different sets of EXCEPTION statements more or less solves this one.