Skip to Main Content

SQL & PL/SQL

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

resetting sqlerrm or how to get only latest errmsg in PLSQL

ShackirJul 1 2014 — edited Jul 1 2014

Hi all,

Iam getting some stacked value in SQLERRM, please find the code and its output. I am expecting only the latest error message, How to avoid this stacking behaviour of the error message.

All replies will be appreciated.

Program:

DECLARE

  LV_1 NUMBER;

BEGIN

   RAISE NO_DATA_FOUND;

EXCEPTION

   WHEN OTHERS THEN

     BEGIN

       RAISE TOO_MANY_ROWS;

     EXCEPTION

       WHEN OTHERS THEN

            DBMS_OUTPUT.put_line(SQLERRM);

     END;

END;

Output:

ORA-01422: exact fetch returns more than requested number of rows

ORA-01403: no data found

Expected Output: ORA-01422: exact fetch returns more than requested number of rows

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 29 2014
Added on Jul 1 2014
11 comments
1,703 views