40

Oracle で、バックアップから新しいテーブルにデータをコピーしましたが、機能しません。

正しい構文は何ですか?

ありがとう

select CODE, MESSAGE into EXCEPTION_CODES (CODE, MESSAGE)
from Exception_code_tmp

エラーは

**SQL Error: ORA-00905: missing keyword
00905. 00000 -  "missing keyword"**
4

5 に答える 5

71

が必要ですINSERT ... SELECT

INSERT INTO exception_codes( code, message )
  SELECT code, message
    FROM exception_code_tmp
于 2012-07-13T14:29:03.293 に答える
53

データでテーブルを作成したい場合。最初にテーブルを作成します:

create table new_table as ( select * from old_table); 

そして挿入

insert into new_table ( select * from old_table);

データなしでテーブルを作成する場合。使用できます:

create table new_table as ( select * from old_table where 1=0);
于 2014-05-28T10:10:00.500 に答える
6
insert into EXCEPTION_CODES (CODE, MESSAGE)
select CODE, MESSAGE from Exception_code_tmp
于 2012-07-13T14:29:16.490 に答える