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: How to get back useful error messages?

Re: How to get back useful error messages?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 15 Sep 1998 17:07:10 GMT
Message-ID: <35ff9e88.5344334@192.86.155.100>


A copy of this was sent to roy_at_popmail.med.nyu.edu (Roy Smith) (if that email address didn't require changing) On Tue, 15 Sep 1998 11:52:35 -0400, you wrote:

>tkyte_at_us.oracle.com wrote:
>> create table t1 ( x int
>> constraint "t1.x cannot be null" check ( x is not null )
>> );
>
>This works fine for NOT NULL, but what about UNIQUE? If I do:
>
>create table t1 (x int constraint "x must be unique" check (x is unique));
>
>I get:
>
>ORA-00908: missing NULL keyword

You've got to use valid syntax for the unique constraint. I used a check constraint -- not a unique constraint. To do unique, you would:

SQL> create table t1 ( x int constraint "x must be UNIQUE" unique ); Table created.

SQL> insert into t1 values ( 1 );
1 row created.

SQL> insert into t1 values ( 1 );
insert into t1 values ( 1 )
*
ERROR at line 1:
ORA-00001: unique constraint (TKYTE.x must be UNIQUE) violated  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Tue Sep 15 1998 - 12:07:10 CDT

Original text of this message

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