Re: Check constraints - alter order of processing ?

From: Bhooshan Prabhu <bhooshan.s.prabhu_at_orbitech.co.in>
Date: 7 Aug 2002 03:01:36 -0700
Message-ID: <16584988.0208070201.83c82d0_at_posting.google.com>


I doubt if this can be done. The way I feel Oracle would handle things is to check if a value being inserted in a column can fit in the column or Not. If the value does fit in, it would then apply the check constraint. If the value doesn't fit the column specification in the 1st place, why would it waste its time in applying a check constraint?

This is as I feel Oracle ought to work. I really do not know how to make Oracle change its order of processing.

regards
Bhooshan

richardshea_at_fastmail.fm (Richard Shea) wrote in message news:<282f826a.0208052242.7f1caa66_at_posting.google.com>...
> Hi - I've defined a check constraint ...
>
> SQL> ALTER TABLE "WSC_WORKITEM"
> 2 ADD CONSTRAINT "CHK_WOR2"
> 3 CHECK (WSC_CHANGE_OR_ERROR in ('1','2'))
> 4 ENABLE
> 5 NOVALIDATE;
>
> ... and that column, WSC_CHANGE_OR_ERROR looks like ...
>
> WOR_CHANGE_OR_ERROR NOT NULL VARCHAR2(1)
>
> ... the problem is that if a process attempts an insert into the table
> and the contents of that column is, eg, '10', you don't get the check
> constraint error message returned but instead ...
>
> ORA-01401 : inserted value too large for column ?
>
> ... is there any way I can Oracle to report the constraint violation
> rather than the ORA-01401 ?
>
> thanks
>
> richard shea
> richardshea at fastmail.fm
Received on Wed Aug 07 2002 - 12:01:36 CEST

Original text of this message