Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When Others - Exceptions 1

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,502
US
I know how to trap known Exceptions, but how do I know what Exception occurred in the WHEN OTHERS part?

Code:
EXCEPTION
  WHEN NO_DATA_FOUND THEN
    -- This Project Number is NOT in DB, 
    -- do something here
  WHEN ZERO_DIVIDE THEN
    -- I know what happened here
  WHEN OTHERS THEN[red]
    -- How do I know what has happened here?
    -- Let me know which Exception happened here, please.[/red]
END;

Is there a way to detect it so I can write it to my error log?
So if TOO_MANY_ROWS exception happen, at least I will know that much.

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Hi,
the error number of the most recent error can be found in SQLCODE and the message in SQLERRM. The complete error stack is stored in ora_server_error_msg.
 
Thank you, that's what I was looking for...

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top