Copying table structure not data : Copy Table « Table « Oracle PL/SQL Tutorial






SQL>
SQL> CREATE TABLE myTable (
  2     Name    VARCHAR(50) PRIMARY KEY NOT NULL,
  3     PhoneNo VARCHAR(15) DEFAULT 'Unknown Phone',
  4     SSN     VARCHAR(15) NOT NULL,
  5     CHECK (SSN LIKE '[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]'));

Table created.

SQL>
SQL>
SQL> CREATE TABLE My_myTables AS SELECT * FROM myTable
  2  WHERE 1=0;

Table created.

SQL>
SQL> drop table myTable;

Table dropped.

SQL> drop table My_myTables;

Table dropped.








6.4.Copy Table
6.4.1.Create a copy table
6.4.2.Create table with primary key
6.4.3.Copy table with adding the primary key
6.4.4.Create a table by copy certain rows
6.4.5.Create a copy table and aggregate function
6.4.6.Create a copy by select specific columns
6.4.7.Copying table structure not data