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: creating a primary key

Re: creating a primary key

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 5 Apr 2000 17:29:17 +0200
Message-ID: <954950744.27478.1.pluto.d4ee154e@news.demon.nl>


Provided you leave out the creation of an unique index in the second example and change the alter to
alter table ac_holiday add constraint ac_holiday_idx primary key etc..

Hth,

Sybrand Bakker, Oracle DBA

mparish <mparishNOmpSPAM_at_inlogic.com.invalid> wrote in message news:065a1400.f0be4973_at_usw-ex0107-050.remarq.com...
> Please note the create table statement. The statment 'using index'
> following the primary key statement creates a system generated index.
> My question, if I create the table, create an index, then issue an
> alter statement, will this accomplish the same thing. I've never seen
> a create table statement with this type of index create.
>
> Create Version one;
> create table ac_holiday (
> user_date date not null,
> cic char (4) not null,
> description varchar2 (254),
> last_updated date,
> primary key ( user_date, cic )
> using index --> new to me
> tablespace fwclient_data pctfree 10
> storage ( initial 20k next 16k pctincrease 50 ))
> tablespace fwclient_data
> pctfree 10 pctused 40
> initrans 1 maxtrans 255
> storage (
> initial 20k next 16k pctincrease 50
> minextents 1 maxextents 121 )
> nocache;
>
> This will use the index created.
>
> Create Version two:
> CREATE TABLE AC_HOLIDAY (
> USER_DATE DATE NOT NULL,
> CIC CHAR (4) NOT NULL,
> DESCRIPTION VARCHAR2 (254),
> LAST_UPDATED DATE)
> TABLESPACE FWCLIENT_DATA
> PCTFREE 10 PCTUSED 40
> INITRANS 1 MAXTRANS 255
> STORAGE (
> INITIAL 20K NEXT 16K PCTINCREASE 50
> MINEXTENTS 1 MAXEXTENTS 121 )
> NOCACHE;
>
> drop index ac_holiday_idx;
> create unique index ac_holiday_idx on ac_holiday(user_date, cic);
>
> ALTER TABLE AC_HOLIDAY
> ADD PRIMARY KEY (USER_DATE, CIC)
> USING INDEX
> TABLESPACE FWCLIENT_DATA PCTFREE 10
> STORAGE(INITIAL 20K NEXT 16K PCTINCREASE 50 ) ;
>
>
> Are these equivalent?
>
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!
>
Received on Wed Apr 05 2000 - 10:29:17 CDT

Original text of this message

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