Duplicate Table in PL/SQL

In PL/SQL, you can use the following statement to duplicate a table and its data:

CREATE TABLE new_table AS
SELECT *
FROM old_table;

In this statement, new_table is the name of the new table to be created, and old_table is the name of the original table to be copied. This statement will copy the structure and data of the original table to the new table.

Additionally, you can also use the INSERT INTO statement to duplicate table data.

INSERT INTO new_table
SELECT *
FROM old_table;

This statement only copies the table data, not the table structure. It is important to note that the structure of the new table must exactly match the structure of the original table, otherwise an error will be thrown.

bannerAds