Create table as select * from another : Copy Table « Table « Oracle PL / SQL






Create table as select * from another

   
SQL> create table myTable(
  2    key_col  primary key,
  3    key_val
  4  )as
  5  select object_name, max( owner||'_'||object_id )from all_objects group by object_name
  6  /

Table created.

SQL>
SQL>
SQL>
SQL> create table myTableCopy(
  2     key_col primary key,
  3     key_val )
  4  as  select * from myTable;

Table created.

SQL>
SQL>
SQL> drop table myTable;

Table dropped.

SQL>
SQL> drop table myTableCopy;

Table dropped.

   
    
    
  








Related examples in the same category

1.Use copy command to create new table
2.Create a copy table and insert value to it
3.Copying selected columns from another table
4.Copying selected columns from multiple tables
5.CREATE Table from another table with consitions
6.Duplicate some or all of the data in one table under a different table name
7.Create a copy table with primary key setting
8.Copying table
9.Copying table structure not data
10.Create a copy table from all_objects
11.Creating from Another Table
12.The table is created with no rows if the query returned no rows.