Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    127

    Unanswered: Indexes & tablespaces

    Hi all,

    could someone please aid in showing me how to create a table (i.e. as alike to the one below), only i would like to place the primary key index in a tablespace called IDX, and create a non-unique index for column C2 also in IDX. Is this possible to be done in a single block of code?, if so, how? only im struggling & require assistance.

    Code:
    CREATE TABLE T1
    (C1 NUMBER CONSTRAINT PK_T1_C1_01 PRIMARY KEY
    ,C2 NUMBER)
    TABLESPACE USERS;
    thanks in advance!

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    As far as I can tell, you'll need two statements - one to create a table (and its primary key), and another one to create additional index.

    USING INDEX TABLESPACE enables you to put index in tablespace different than the one that stores the table.
    Code:
    CREATE TABLE t1 
      (c1 NUMBER CONSTRAINT pk_t1 PRIMARY KEY USING INDEX TABLESPACE idx,
       c2 NUMBER);
    
    CREATE INDEX i2_t1 ON t1 (c2) TABLESPACE idx;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •