Friday, June 19, 2009

How to copy the contents of one table to another table in Oracle?

CREATE TABLE newTable AS SELECT * FROM emp WHERE sal > 2000;

insert into newTable SELECT * FROM emp WHERE sal > 2000 ; "to copy the contents"

insert into newTable SELECT * FROM emp WHERE 1> 2 ; "to copy the structure"


with the above statement the contents from the table emp will be copied to temp with the same structure as emp table.

No comments:

Post a Comment