Best way to clone a table?
395981Jul 20 2004 — edited Jul 21 2004Hi,
What is the best way to clone an existing table definition?
What I mean is, I want to do the following:
create table tab2 as
select * from tab1;
delete from tab2;
commit;
But clearly this involves copying all the data and then delete it. Is there a more efficient way?
Another alternative I could think of is:
create table tab2 as
select * from tab1 where rownum < 2;
delete from tab2;
commit;
This would copy only one row instead of all the rows in tab1. This is clearly much more efficient than the first approach, but I still don't like the idea of copying the data and deleting it.
I am sure there would be a "cleaner" way. Any ideas?
Thanks in advance,
Rajesh