Oracle copy data to another table

前端 未结 5 1690
旧时难觅i
旧时难觅i 2020-12-30 20:41

In the Oracle, I copy data from a backup to a new table, it doesn\'t work.

what is the correct syntax ?

Thanks

select CODE, MESSAGE into EXC         


        
相关标签:
5条回答
  • 2020-12-30 20:49
    insert into EXCEPTION_CODES (CODE, MESSAGE)
    select CODE, MESSAGE from Exception_code_tmp
    
    0 讨论(0)
  • 2020-12-30 20:55

    Creating a table and copying the data in a single command:

    create table T_NEW as
      select * from T;
    

    * This will not copy PKs, FKs, Triggers, etc.

    0 讨论(0)
  • 2020-12-30 21:02

    If you want to create table with data . First create the table :

    create table new_table as ( select * from old_table); 
    

    and then insert

    insert into new_table ( select * from old_table);
    

    If you want to create table without data . You can use :

    create table new_table as ( select * from old_table where 1=0);
    
    0 讨论(0)
  • 2020-12-30 21:12
    create table xyz_new as select * from xyz where 1=0;
    

    http://www.codeassists.com/questions/oracle/copy-table-data-to-new-table-in-oracle

    0 讨论(0)
  • 2020-12-30 21:14

    You need an INSERT ... SELECT

    INSERT INTO exception_codes( code, message )
      SELECT code, message
        FROM exception_code_tmp
    
    0 讨论(0)
提交回复
热议问题