Home > Database > Mysql Tutorial > How to Create an Oracle Table Copy with Only the Structure?

How to Create an Oracle Table Copy with Only the Structure?

Mary-Kate Olsen
Release: 2024-12-30 10:42:17
Original
854 people have browsed it

How to Create an Oracle Table Copy with Only the Structure?

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;
Copy after login

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;
Copy after login

Limitations:

Note that this method excludes the copying of certain elements:

  • Sequences
  • Triggers
  • Indexes
  • Some constraints
  • Materialized view logs
  • Partitions are not handled

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template