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 EXCEPTION_CODES (CODE, MESSAGE)
from Exception_code_tmp
the error is
**SQL Error: ORA-00905: missing keyword
00905. 00000 - "missing keyword"**
insert into EXCEPTION_CODES (CODE, MESSAGE)
select CODE, MESSAGE from Exception_code_tmp
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);
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
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.
Source: Stackoverflow.com