Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Check constraints, the impossible dream?
Niall Litchfield doodled thusly:
>> But what about the other problem with more than one check constraint per
>> table?
>
>You are right. Check constraints do not provide of themselves useful error
>messages to the end user, so if you wish to provide a more meaningful error
>you have to intercept the error and interpret it using code. At least if
>there is another way I have yet to come across it.
PMFJI. I've found this is a common problem. I think Nial is correct in assuming there is no other way. The best I've come up with over the years is to create these check constraints by hand whenever I can (NOT NULL cannot be created by hand <sigh>) and giving them a meningful name instead of the horrible default names that Oracle and Designer come up with. That way when Oracle comes up with the name of the constraint that was violated, a user can at least make some sort of sense out of it.
A generalised exception handling mechanism for SQL would be most welcome, but I doubt we'll ever see it. Something like the Java "try...catch...finally" pair would be darn useful.
Cheers
Nuno Souto
nsouto_at_optushome.com.au.nospam
Received on Fri Mar 22 2002 - 19:32:49 CST