DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Capture exact error in exception section

  1. #1
    Join Date
    Dec 2001
    Location
    Keene, NH
    Posts
    510
    (9i)
    Can I capture an exact Oracle error message in an exception section of a trgger (one that I want to ignore)?

    Any syntax help would be greatly appreciated.
    Don't blame me, I'm from Red Sox Nation.

  2. #2
    Join Date
    Dec 2001
    Location
    Keene, NH
    Posts
    510
    I swear I spend 45 minutes in the Oracle documentation yesterday and did not find what I was looking for.

    Today is a different story:

    DECLARE
    deadlock_detected EXCEPTION;
    PRAGMA EXCEPTION_INIT(deadlock_detected, -60);
    BEGIN
    ...
    EXCEPTION
    WHEN deadlock_detected THEN
    -- handle the error
    END;


    Don't blame me, I'm from Red Sox Nation.

  3. #3
    Join Date
    Sep 2001
    Posts
    10
    Try PL/SQL variable SQLERRM. It contains Oracle error msg text. Here is an example. I haven't tried it in a trigger.

    SQL> ed
    Wrote file afiedt.buf

    1 DECLARE
    2 I NUMBER;
    3 BEGIN
    4 SELECT O_ID INTO I FROM Orders;
    5 EXCEPTION
    6 WHEN OTHERS THEN
    7 DBMS_OUTPUT.PUT_LINE(SQLERRM);
    8* END;
    SQL> /
    ORA-01422: exact fetch returns more than requested number of rows

    PL/SQL procedure successfully completed.

    SQL>


    Rgds,
    M
    OCP 8i DBA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width