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: Why I can't have primary key on field that has index?

Re: Why I can't have primary key on field that has index?

From: <mashy_at_null.net>
Date: 1998/09/18
Message-ID: <6ttpv9$oi5$1@nnrp1.dejanews.com>#1/1

That is because , when you ask the create table script to create a primary key, it creates the primary key index for that column. So if you will try to create an index again on that column, Oracle is smart enough to scream an error !

Cheers !

Mahesh "Mashya"
mashy_at_null.net

In article <6tsamo$8o3$1_at_nnrp1.dejanews.com>,   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
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Fri Sep 18 1998 - 00:00:00 CDT

Original text of this message

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