question

OraLearner avatar image
OraLearner asked

Can we copy a table as another table?

I want to copy a table as another table. Like copying a document in windows.

Is it possible?

I have a scenario where I need to create 5 tables similar to existing table. The only change is table name and adding some prefix text to existing columns.

Is there any simple way we can do this?

oracletable
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
HillbillyToad avatar image
HillbillyToad answered

Check out the 'CREATE TABLE AS SELECT' syntax. You can build a table based on the results of a SELECT statement.

3 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

It's one of my FAVORITE SQL tricks, and way less overhead than manually populating a table with multiple INSERTS.
1 Like 1 ·
Thank you very much. This reduced lot of my work. I found the required link here - http://www.oracle-training.cc/t_garmany_easyoracle_create_table_as_select.htm
0 Likes 0 ·
I guess.. this would be my favourite too now onwards :)
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.