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: ORA-00001 when populating table

Re: ORA-00001 when populating table

From: Jonathan Gennick <gennick_at_worldnet.att.net>
Date: 2 Jan 1999 00:43:41 GMT
Message-ID: <369365a2.13331824@netnews.worldnet.att.net>


On Thu, 31 Dec 1998 14:33:29 GMT, grndvu_at_ids.net wrote:

>I am stepping through a 3rd party how-to book on Oracle8. The book calls for
>creating an ORDER_DETAILS table in Oracle8 Navigator with a NO DEFAULT, NOT
>NULL, NOT UNIQUE ORDER_ID primary key field.

It is not possible to have a NOT UNIQUE primary key. Primary keys must be unique. That's inherent in the definition. Either there is a mistake in the book, or your are misinterpreting what it is asking you to do.

>The book then calls for
>populating the table with records, several of which have the same ORDER_ID
>number.

If the table name is ORDER_DETAIL, I would expect the primary key to consist of two fields. One would be the ORDER_ID, and the other would be some sort of sequence number. Is it possible that you are defining the primary key incorrectly?

I don't know what book you are reading, but here is what I would expect to see based on what you said in yoru note:         

	create table order_details (
		order_id		number,
		line_item_no	number,
		other fields go here,
		constraint pk_order_details 
			primary key (order_id, line_item_no)
		);

Multiple records could have the same order_id, but the combination of order_id and line_item_no would have to be unique.

Does this help you at all? What book is it that you are reading?

Jonathan Received on Fri Jan 01 1999 - 18:43:41 CST

Original text of this message

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