Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Check constraints, the impossible dream?

Re: Check constraints, the impossible dream?

From: Nuno Souto <nsouto_at_optushome.com.au.nospam>
Date: Sat, 23 Mar 2002 01:32:49 GMT
Message-ID: <3c9bda02.2341269@news-vip.optusnet.com.au>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US