1

The problem: I need to get error message from oracle database exception, but I don't know how.

Example:

try:
   ...
   cursor.execute("<SOME SQL>")
except DatabaseError, e:
   error, = e.args
   print e.message

This code outputs something like:

ORA-20000: Some error description
ORA-06512: at "GEN.ERR", line 3
ORA-06512: at "SCHEME_NAME.PACKAGE_NAME", line 49
ORA-06512: at line 1

So, how can I get only error description ("Some error description") in the above example, but not the full error message with table names etc. ? I know that I can parse this output but I think there should be more clever way to get the error message.

Thanks.

1
  • <some sql> isn't really good enough here. Show us real code and real errors please.
    – mmmmmpie
    Commented Oct 13, 2014 at 13:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.