Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to select a primary key?
If you want a primary key then you need to define one.
alter table coffees add constraint pk_coffees primary key (<key column name>);
will add a primary key named pk_coffees for you.
Expecting INSERT statements to update prexisting rows is just wrong. to update an existing row you use the UPDATE statement.
-- Niall Litchfield Oracle DBA Audit Commission UK ***************************************** Please include version and platform and SQL where applicable It makes life easier and increases the likelihood of a good answer ****************************************** "Konrad Den Ende" <konrad_at_voxway.com> wrote in message news:ag3rf0$17m$1_at_news.gu.se...Received on Fri Jul 05 2002 - 06:52:11 CDT
> When i execute the example on Suns website:
> "INSERT INTO COFFEES " +
> "VALUES ('Colombian', 101, 7.99, 0, 0)");
> then everything is fine the first time.
>
> What i expected it to do the next time i execute the
> very same line is to UPDATE row 'Colombian' with
> (the same) values provided.
>
> To my amazment i get more and more rows with the same
> name. I understand that Oracle believs i don't want to
> use any primary key. Why? How to solve this?
> --
>
> Vänligen
> Konrad
> -------------------------------------------------------
> URL: http://konrads.webbsida.com
> E-Mail: konrad_at_voxway.com
> Phone: (+46) 0708 - 70 73 92
> ICQ: 132 250 451
>
>
>
>
>
![]() |
![]() |