Home » SQL & PL/SQL » SQL & PL/SQL » Cloning a table (Oracle 10.2.0.4)
Cloning a table [message #376328] Wed, 17 December 2008 00:20 Go to next message
hedonist123
Messages: 119
Registered: August 2007
Senior Member
Hi,

I wish to create an exact copy of a table with its triggers, primary keys, indexes and data.

Is there a way to do the same?

create table emp_new as select * from emp;


only creates the table with the data.

Thanks,

Sharath

[Updated on: Wed, 17 December 2008 00:24]

Report message to a moderator

Re: Cloning a table [message #376330 is a reply to message #376328] Wed, 17 December 2008 00:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use DBMS_METADATA to create the object and dependencies then insert into it.

Regards
Michel
Re: Cloning a table [message #376338 is a reply to message #376328] Wed, 17 December 2008 01:13 Go to previous message
Littlefoot
Messages: 20896
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I guess that you don't want to do that in the same schema where the original table is (as you can't have more than one index, primary key, etc. having the same name as the existing one).

Therefore, EXPORT and IMPORT utilities might be another choice.
Previous Topic: dbms_job sumbit various dates
Next Topic: creating file on server
Goto Forum:
  


Current Time: Tue Dec 06 10:09:50 CST 2016

Total time taken to generate the page: 0.08576 seconds