Mailing List Archive

Parsing oracledb errors
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@popmail.med.nyu.edu>
New York University School of Medicine