Creating an Oracle Table Copy Sans Data
One can easily duplicate an Oracle table's structure and data using the statement:
create table xyz_new as select * from xyz;
However, scenarios may arise where only the table's structure is desired.
Solution:
To create a table copy with just the structure, simply employ a WHERE clause that excludes all rows:
create table xyz_new as select * from xyz where 1=0;
Limitations:
Note that this method excludes the copying of certain elements:
This approach provides a quick and convenient means of creating a table structure clone without replicating its data.
The above is the detailed content of How to Create an Oracle Table Copy with Only the Structure?. For more information, please follow other related articles on the PHP Chinese website!