1
我在將單個外部表指令轉換爲PLSQL過程時遇到了一些問題。 特別是,這是完美工作的外部表創建指令。將外部表創建指令轉換爲PLSQL過程出錯
create table TMP_TBL (
id VARCHAR2(10)
)
organization external (
TYPE ORACLE_LOADER
default directory DATA_DIR
access parameters (
RECORDS DELIMITED BY NEWLINE
fields terminated by '|'
missing field values are null
)
location ('test.txt')
)
reject limit unlimited;
我試圖讓這個PLSQL過程創建給定的外部數據文件的表。這是我從現在開始的工作,但當我打電話時,仍然有些問題。
PROCEDURE CREATE_TMP_TBL(FILENAME VARCHAR2) IS
BEGIN
EXECUTE IMMEDIATE 'create table TMP_TBL (
id VARCHAR2(10)
)
organization external (
type oracle_loader
default directory DATA_DIR
access parameters (
records delimited by newline
fields terminated by ''|''
missing field values are null
)
location ('''||FILENAME||''')
)
reject limit unlimited;';
END CREATE_TMP_TBL;
執行的方法,用下面的命令:
exec pkg_load.CREATE_TMP_TBL('test.txt');
它給我這個錯誤:
Error report:
ORA-00911: invalid character
ORA-06512: at "PKG_LOAD", line 43
ORA-06512: at line 1
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:
線43是過程CREATE_TMP_TBL的 「BEGIN」 號線。
信息:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
任何建議來解決,歡迎這個問題。 謝謝諮詢,
卡羅
如果你想有可能做的是改變引用的文件,你可以用ALTER TABLE語句來做到這一點 - 在這裏可以看到你可以對外部表進行的所有修改(LOCATION屬性)。 http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables013.htm#i1007591 – OldProgrammer 2013-02-17 16:37:56