Re: Not Null constraints

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/12/09
Message-ID: <32ac29ce.1833736_at_dcsun4>#1/1


On Sat, 07 Dec 1996 00:50:29 -0500, John Parrott <spo_at_interlog.com> wrote:

>When doing an insert, how can I determine which fields is generating the
>'Not Null column is missing' error? Ideally I'd like to know the name
>of the integrity constraint which raised this message. I know that
>there may be multiple mandatory fields which are blank. I just want one.
>
>I've developed a package which formats error messages given an integrity
>constraint. Now all I need is a way to find the constraint. I'm ok for
>primary key and referential integrity constraints.
>
>When I get this working I might post a copy of this package.
>--
>John Parrott
>Elysium Financial Systems
>spo_at_interlog.com
>http://www.interlog.com/~spo
>

If you use a check constraint instead of "not null", you can get the name of the constraint violated in the error message, for exampe:

create table ...
(....
  y int constraint y_is_null check (y is not null)  ....
)
/

insert into table .. ( y ) values ( null ); *
ERROR at line 1:
ORA-02290: check constraint (TKYTE.Y_IS_NULL) violated  

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com

  • Check out Oracle Governments web site! ----- Follow the link to "Tech Center" and then downloadable Utilities for some free software...

statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Mon Dec 09 1996 - 00:00:00 CET

Original text of this message