Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;
share|improve this question
up vote 5 down vote accepted

Like this:

create table THIS_TABLE (
  id number NOT NULL, 
  constraint THIS_TABLE_PK PRIMARY KEY(id) 
) 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.

share|improve this answer
Well, now I feel dumb. I should have tried the same syntax as for an outline declaration. Thanks for the feedback! – Pedro Mendes Sep 5 '13 at 23:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.