Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: ddl error? help! please

Re: ddl error? help! please

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Mon, 12 Feb 2001 06:11:17 +0100
Message-ID: <t8gd40fv81fu57@beta-news.demon.nl>

You must have the *same sequence* of columns in the transaction table as in the item table.
Now you only have a *partial* foreign key as you are using and referencing only *one* column.

Hth,

Sybrand Bakker, Oracle DBA

"albrrat" <albrrat_at_hotmail.com> wrote in message news:981940107.501271_at_news2.bigplanet.com...
> If i include the full composite primary key in the second error listed, I
> receive an error that there are too many collumns listed. Then what is the
> answer?
>
> ALTER TABLE transaction ADD(CONSTRAINT fk_trans2 FOREIGN KEY(item_id)
> references item(item_id))
>
> error:
>
> or:
>
> ALTER TABLE transaction ADD(CONSTRAINT fk_trans2 FOREIGN KEY(item_id)
> references item(item_prefix,item_id,item_sequence,item_media))
>
> gives an error also
>
>
>
>
> "Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote in message
> news:t8dd73ho8qs14a_at_beta-news.demon.nl...
> > Comments embedded below
> >
> > Hth,
> >
> > Sybrand Bakker, Oracle DBA
> >
> > "albrrat" <albrrat_at_hotmail.com> wrote in message
> > news:981907163.856829_at_news2.bigplanet.com...
> > > ALTER TABLE transaction ADD(CONSTRAINT ck_status
 CHECK((transaction_status
 =
> > > 'Open') OR (transaction_status = 'Closed'));
> > >
> > > ORA-00907: missing right parenthesis
> > >
> >
> > As you are using an (albeit redundant) left parenthesis before the word
> > constraint, you'll need an extra right parenthesis before the ;
> >
> >
> > > and:
> > >
> > > ALTER TABLE transaction ADD(CONSTRAINT fk_trans2 FOREIGN KEY(item_id)
> > > references item(item_id))
> > >
> > > *
> > > ERROR at line 1:
> > > ORA-02270: no matching unique or primary key for this column-list
> > >
> > > pk definition for item is:
> > >
> > > ALTER TABLE item ADD(CONSTRAINT cpk_ip_iid_sn_im PRIMARY
> > > KEY(item_prefix,item_id,item_sequence,item_media));
> > >
> > >
> > Yeah sure. Your foreign key doesn't exactly match your primary key,
 doesn't
> > it?
> >
> >
> >
> >
> > >
> > >
> >
> >
>
>
Received on Sun Feb 11 2001 - 23:11:17 CST

Original text of this message

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