4

I have two questions about inline constraints declarations for Oracle tables:

  1. Is it a bad practice? If so, why?

  2. How could one declare a different tablespace for the primary key and index like it's done when using the outline declaration? Something like

 create table THIS_TABLE (
 id number, 
 constraint THIS_TABLE_PK (id) tablespace INDEX_TABLESPACE
 ) tablespace DATA_TABLESPACE;
András Váczi
31.8k13 gold badges103 silver badges152 bronze badges
asked Sep 3, 2013 at 16:13

1 Answer 1

11

Like this:

create table THIS_TABLE (
 id number NOT NULL, 
 constraint THIS_TABLE_PK PRIMARY KEY(id) 
 USING INDEX TABLESPACE INDEX_TABLESPACE
) tablespace DATA_TABLESPACE;

USING INDEX TABLESPACE is the syntax - you weren't far off.

As far as good/bad practice is concerned, that's opinion-based, so not really something that should be asked here. The alternative is to use the ALTER TABLE .... syntax after table creation.

answered Sep 3, 2013 at 17:59
1
  • Well, now I feel dumb. I should have tried the same syntax as for an outline declaration. Thanks for the feedback! Commented Sep 5, 2013 at 23:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.