Re: tablespace question.

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Fri, 14 Feb 2003 08:22:50 -0800
Message-ID: <3E4D17DA.2D4A66A6_at_exesolutions.com>


Mauro Papandrea wrote:

> DA Morgan wrote:
>
> > 1. Do not use the syntax you used to create a primary key but rather use
> > the ALTER TABLE statement to explicity create your primary key and other
> > constraints. The advantage it gives is that you can specify the tablespace
> > in which the associated index is created, name the constraint with a name
> > corresponding to its type and table, and the same for the index. The
> > syntax you want is:
> >
> > ALTER TABLE <table_name>
> > ADD CONSTRAINT pk_table_name
> > PRIMARY KEY <comma_delimited_list_of_column_names>
> > USING INDEX
> > PCTFREE <integer_value>
> > TABLESPACE <tablespace_name>;
> >
> > Same goes for creating tables. Always specify PCTFREE, PCTUSED, and
> > TABLESPACE name.
> >
> >
> > For another user to see that the table exists:
> >
> > GRANT SELECT ON <table_name> TO <schema_name>;
> >
> > Daniel Morgan
>
> Sorry for my breaking in sir, but what is wrong with a create like this ?
>
> CREATE TABLE blah
> (
> c1 NUMBER,
> c2 CHAR(2) CONSTRAINT c2_nn NOT NULL,
> c3 DATE ,
> CONSTRAINT pk_blah PRIMARY KEY (c1) USING INDEX TABLESPACE
> my_index_tablespace )
>
> Does it not give the same flexibility as an alter table ?
> I can give the contraint a name of its own, its tablespace and, if i like, a
> storage clause the same as with an alter table.
>
> Am i missing anything ?
>
> Regards
>
> Mauro

What Sybrand says ... but you'll have no problems if you specify name, storage parameters, and tablespace. Things not done in the OP's example.

Daniel Morgan Received on Fri Feb 14 2003 - 17:22:50 CET

Original text of this message