Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Why I can't have primary key on field that has index?
create table t1(
f1 integer constraint f1_index primary key disable;
f2 integer not null)l
commit;
create index f1_index on t1(
f1);
commit;
alter table t1 enable primary key;
commit;
primary keys are by definition not null and unique!
HTH
tED
RP Data Solutions wrote in message <3601bc13.1509890267_at_news.cyberus.ca>...
>badstreetboy_at_my-dejanews.com wrote:
>
>>I try to create a table by:
>>
>>CREATE TABLE t1(
>> f1 INTEGER NOT NULL PRIMARY KEY,
>> f2 INTEGER NOT NULL);
>>CREATE INDEX f1_index ON t1(
>> f1);
>>
>>Then it gives me an err:
>>
>>ERROR at line 2:
>>ORA-01408: such column list already indexed
>>
>>Why this happen? I would appreciate if anyone can help me. Thanks!
>>
>>
>>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>>http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
>
>Keep in mind that oracle enforces primary keys via a unique
>index....which explains the error message.
>
>Cheers, Robert Prendin
>#****************************************************
># RP Data Solutions Inc.
># Specializing in ORACLE DBA Support Services
># We offer 24HR remote DBA support!!!
>#****************************************************
>
>
Received on Fri Sep 18 1998 - 00:00:00 CDT