Re: tablespace question.

From: Mauro Papandrea <mauro.papandrea_at_consulenti.csi.it>
Date: Fri, 14 Feb 2003 14:45:56 +0100
Message-ID: <3E4CF314.1E846003_at_consulenti.csi.it>


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 Received on Fri Feb 14 2003 - 14:45:56 CET

Original text of this message