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.
<some sql>
isn't really good enough here. Show us real code and real errors please.