Re: Help with CONSTRAINTs in Oracle

From: Jonathan Lewis <Jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 6 Jan 1995 19:55:41 +0000
Message-ID: <789422141snz_at_jlcomp.demon.co.uk>


In article <3e3hoe$4ps_at_hermes.is.co.za>

           debj0113_at_sasoldns.sasol.co.za "Jannie de Beer GID SSG" writes:

: Hi.
: I am currently involved in converting an inhouse Sybase system to
: Oracle 7. But I have a problem with the way that Oracle seems to
: handle the CONSTAINT clause. When I declare a constaint in my
: Sybase system on a column or table, Sybase gives me the possibility
: to bind or link an error message to that constraint. As that constraint
: is violated Sybase then responds with a meaningfull error message.
:
: I cannot find a way to bind a meaningfull error message to a
: constraint in Oracle. This is esspesialy a problem when more than
: one constraint are linked to a table and it's columns, as the user
: doen't know which constraint was violated and produced the error.
:

What a nice idea:

Obviously in the _application_ you can have code that intercepts the standard error message, substrings out the constraint name from it then produces a suitable error message based on the name. This is obviously not terribly nice (although you could put it into a database package to keep it clean :-)

I _think_ that the best you can do otherwise is to use pre-insert/ pre-update triggers instead of constraints, then use exceptions etc. to give your own numbers and texts to errors in the triggers.

-- 
Jonathan Lewis
Received on Fri Jan 06 1995 - 20:55:41 CET

Original text of this message