Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recreate table within different name and tablespace

Status
Not open for further replies.

Advocate

IS-IT--Management
Oct 18, 2000
135
GB
could anyone help me with sample syntax, or point me to some examples, to recreate table from template using a different tablespace ?

eg

create table new_table_name
as (select * from template_table)
tablespace target_tablespace

is the tablespace syntax correct/recommended ?


regards, david - no such thing as problems - only solutions.
 
thank you for response

unfortunately, no specific example there for me ...

CREATE TABLE NW.STG_DAX AS (SELECT * FROM NW.STG_DAX_TEMPLATE WHERE 1=0) TABLESPACE NW.SCRATCH

getting following error message when run in toad sql editor

ORA-00933: SQL command not properly ended

and word TABLESPACE highlighted

am i doing something silly as usual ... :) ?


regards, david - no such thing as problems - only solutions.
 
Hi
the command is
create table <TABLE_NAME> tablespace <TABLESPACE NAME>
as select * from <ANOTHER TABLE>;

Regards,
Gunjan
 
thank you gunjan14,

that works ok but cannot improve to include extents ie ...

create table <TABLE_NAME> tablespace <TABLESPACE NAME>
STORAGE (
INITIAL_EXTENT <v_INITIAL_EXTENT>
NEXT_EXTENT <v_NEXT_EXTENT>
MAX_EXTENTS <v_MAX_EXTENTS> )

as select * from <ANOTHER TABLE>;

anybody please ?


regards, david - no such thing as problems - only solutions.
 
Advocate,

Here is an actual code sample on my 9.2.0.4 (but the same syntax should work on any version, provided you are not using a LMT):
Code:
create table s_emp3 tablespace system
storage (initial 16k next 16k maxextents unlimited)
as select * from s_emp;

Table created.

Let us know of either success or problems.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 06:49 (26Jul04) UTC (aka "GMT" and "Zulu"), 23:49 (25Jul04) Mountain Time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top