現在、PL/SQLで複数のテーブルの作成が出来るようにしようとしているのですが、使用不可能な文字と言われてはねられています。
おそらくEXECUTE IMMEDIATEの実行に指定している変数に何か問題があるのではと思っているのですが、それとも動的SQLでテーブル作成事態が出来ないのでしょうか?
アドバイスのほど、宜しくお願いいたします。
PL/SQL
1SET SERVEROUTPUT ON; 2 3DECLARE 4 CURSOR cursor_emp IS 5 SELECT TABLE_NAME 6 FROM TT_TABLE; 7 8 record_emp cursor_emp%ROWTYPE; 9 10 wk_sql varchar2(1000); 11 12BEGIN 13 OPEN cursor_emp; 14 LOOP 15 FETCH cursor_emp INTO record_emp; 16 EXIT WHEN cursor_emp%NOTFOUND; 17 18 wk_sql := 'CREATE TABLE TEST_' || record_emp.TABLE_NAME || 19 ' as select * from ' || record_emp.TABLE_NAME || ' WHERE 1 = 0;'; 20 21 EXECUTE IMMEDIATE wk_sql; 22 wk_sql := ''; 23 24 END LOOP; 25 CLOSE cursor_emp; 26 27END;
エラー内容
エラー・レポート -
ORA-00911: 文字が無効です。
ORA-06512: 行19
00911. 00000 - "invalid character"
*Cause: identifiers may not start with any ASCII character other than
letters and numbers. $#_ are also allowed after the first
character. Identifiers enclosed by doublequotes may contain
any character other than a doublequote. Alternative quotes
(q'#...#') cannot use spaces, tabs, or carriage returns as
delimiters. For all other contexts, consult the SQL Language
Reference Manual.
*Action:

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/03/01 03:44