Home >Database >Mysql Tutorial >How to Create an Empty Table Copy with the Same Structure as an Existing Oracle Table?

How to Create an Empty Table Copy with the Same Structure as an Existing Oracle Table?

Patricia Arquette
Patricia ArquetteOriginal
2025-01-01 10:40:11387browse

How to Create an Empty Table Copy with the Same Structure as an Existing Oracle Table?

Creating a Table Copy without Data in Oracle

Question:

How can I create an exact copy of an Oracle table structure without duplicating the underlying data?

Answer:

To create a table copy with the same structure but no data, you can use the following statement:

create table xyz_new as select * from xyz where 1=0;

Limitations:

This method does not copy the following elements to the new table:

  • Sequences
  • Triggers
  • Indexes
  • Some constraints
  • Materialized view logs

Additionally, it does not handle partitions.

The above is the detailed content of How to Create an Empty Table Copy with the Same Structure as an Existing Oracle Table?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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