Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to raise an application error message
    text
    copied!<p>For debugging purposes, I need to raise an application level message based on given flag. Here is exception code</p> <pre><code> EXCEPTION WHEN dml_errors THEN l_errors := SQL%BULK_EXCEPTIONS.COUNT; S_Publish('I', 'Number of statements that failed: ' || l_errors); FOR i IN 1..l_errors LOOP S_Publish('I', 'Error #' || TO_CHAR(i) || ' occurred during '|| 'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX); S_Publish('I', 'Error message is ' || SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE)); S_Publish('I', 'Failing Record ID is ' || sap_tbl_ins(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX).DEVICE_PIN); END LOOP; IF g_app_error_flag THEN raise_application_error(-20707, 'Fatal Error: Replication script exceptions', TRUE); END IF; WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('Error on record:' || l_zzman); S_Publish('I', 'SAP_EQUI Update: Failure processing record ' || l_zzman); S_Publish ('F'); IF g_app_error_flag THEN raise_application_error(-20708, 'Fatal Error: Replication script exceptions', TRUE); END IF; </code></pre> <p>now given this code, the <strong>raise_application_error</strong> should raise an whenever the **g_app_error_flag is true. However, in all cases (i mean with testing environment where i am failing the script intentionally by adding some constraint on the table), all i see is DML error i.e.</p> <pre><code>ORA-01403: no data found ORA-06512: at "DBNAME.PRODUCT_COPY_PACKAGE", line 1808 ORA-24381: error(s) in array DML ORA-06512: at "DBNAME.PRODUCT_COPY_PACKAGE", line 84 ORA-06512: at line 3 </code></pre> <p>could you guys suggest whats going on?</p> <p>P.S:</p> <p>here is the definition for S_Publish. There is no "raise" in the S_Publish.</p> <pre><code> PROCEDURE S_Publish (i_type IN VARCHAR2, i_msg IN VARCHAR2 DEFAULT NULL) IS BEGIN CASE WHEN i_type = 'G' THEN IF g_debug_flag THEN INSERT INTO logtable (tstamp,line) values (SYSDATE, i_msg); COMMIT; g_counter := 0; END IF; WHEN i_type = 'F' THEN g_err_code := SQLCODE; g_err_msg := TO_CHAR(g_err_code)||' '||SUBSTR(SQLERRM, 1, 100); INSERT INTO logtable (tstamp,line) values (SYSDATE, g_err_msg); COMMIT; WHEN i_type = 'I' THEN INSERT INTO logtable (tstamp,line) values (SYSDATE, i_msg); COMMIT; g_counter := 0; END CASE; END S_Publish; </code></pre> <p>After little debugging thats what i have figured out so far. I don't know whats ther eaosn behind it</p> <p>So the problem is that the program exits no sooner it ends printing errors i.e. the <code>FOR i IN 1..l_errors LOOP</code>. The program exits at <code>END LOOP</code>. Why anything after that isn't being executed? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload