Parsing oracledb errors

Roy Smith roy at popmail.med.nyu.edu
Mon Jul 26 16:03:07 EDT 1999


I've built my database with lots of named constraints.  I'd like to be
able to figure out, from the error message I get in a try/except
oracledb.error, exactly what constraint I violated.  For example, if I
get:

EXECUTE caused a ORA-00001: unique constraint (NETDB.U_MACHINE_HOSTNAME)
violated

I want to pull out U_MACHINE_HOSTNAME, which tells me exactly what went
wrong.  Is there any easy way to do this, without having to parse every
error message string?  It's not so much that it's a pain to have to parse
them, but I'm not even sure that they'll all be in a regular format, so
parsing them may be impossible.

-- 
Roy Smith <roy at popmail.med.nyu.edu>
New York University School of Medicine





More information about the Python-list mailing list