Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Continue after an exception is raised

oraLaroFeb 22 2018 — edited Feb 22 2018

12.1.0.2

Is it possible to generate an exception in a loop but continue?  Note the wording, I want the error raised, not handled.

Example:  I want 10 errors raised in below code but we only get 1, the first 1 as expected, and then the code exits.   If I add an exception clause, I can set to continue on error but the error isnt really raised then.

    declare

     v_chr  varchar(10);

      begin

       dbms_output.put_line('Start :' || to_char(systimestamp, 'HH24:MI:SS.FF6'));

        for i in 1..10

         loop

            select to_number('a') into v_chr from dual;

         end loop;

         dbms_output.put_line('End :' || to_char(systimestamp, 'HH24:MI:SS.FF6'));

         end;

Is it possible?   Logging the errors to a table in the exception clause is not what Im looking for.  an ORA- error has to be raised.   

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 22 2018
Added on Feb 22 2018
15 comments
14,101 views