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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Primay keys

Re: Primay keys

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Thu, 9 Dec 1999 18:36:56 +0100
Message-ID: <82op5j$1591k$1@oceanite.cybercable.fr>

Jan <Jan_Gerards_at_hotmail.com> a écrit dans le message : 82onsh$a3p$1_at_tesla.a2000.nl...
> I have tried 2 ways:
> -1.
> create table bbb
> ( field1 char(6) primary key,
> field2 char(6) primary key);
> error: ora-02260: table can have only one primary key

syntax is:
create table bbb
 ( field1 char(6),
 field2 char(6),
 primary key (field1, field2));

You can use primary on column definition only if your PK has one column.
In your statement, Oracle analyzer thinks there isa primary key for field1 and then another one for field2.

>
> -2.
> create table bbb
> (field1 char(6),
> field2 char(6)
> primary key (field1,field2));
> found this in one in an old sql book but it doesn't work.
> error:
> error at line 4: ora-00907: missing right parenthesis.

There must be a comma between field2 definition and primary key.

>
> I already got one solution and that is to use constraints
> (but first I have to find out how constraints work).
> I'm just a newbie and every step I make costs me a lof of
> time. I have experience with access, notes/domino so I'm
> not a newbie in database developing, only a newbie in oracle.
> I have to say that oracle is terrible difficult for newbies.
>
> thanks to all,
> Jan
>
> "Michel Cadot" <micadot_at_netcourrier.com> wrote in message
> news:82m1j8$116ca$1_at_oceanite.cybercable.fr...
> > What is your command to create it and your error (ORA-...)?
> >
> > Jan <Jan_Gerards_at_hotmail.com> a écrit dans le message :
> > 82ljb5$622$1_at_tesla.a2000.nl...
> > > I have a table with a few fields.
> > > Two of them (together) I want to make a primary key.
> > > But it doesn't work.
> > > Do you have any ideas ?
> > >
> > > thanks in advance,
> > > Jan
>
>
>

--
Have a nice day
Michel Received on Thu Dec 09 1999 - 11:36:56 CST

Original text of this message

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