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

creating a primary key

From: mparish <mparishNOmpSPAM_at_inlogic.com.invalid>
Date: Wed, 05 Apr 2000 08:12:19 -0700
Message-ID: <065a1400.f0be4973@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?

Received on Wed Apr 05 2000 - 10:12:19 CDT

Original text of this message

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