我想創建外部表,但出現錯誤。選擇外部表時出現ORA錯誤
下面是一個使用創建外部表的代碼,
CREATE TABLE "emp_ext"
(
"EMPNO" NUMBER(6),
"ENAME" VARCHAR2(20),
"JOB" VARCHAR2(25),
"MGR" NUMBER(6),
"HIRE_DATE" DATE,
"SAL" NUMBER(8,2),
"COMM" NUMBER(2,2),
"DEPTNO" NUMBER(4)
)
ORGANIZATION external
(
TYPE oracle_loader
DEFAULT DIRECTORY EXTDIR
ACCESS PARAMETERS
(
RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII
BADFILE 'EXTDIR':'employees.bad'
LOGFILE 'employees.log_xt'
READSIZE 1048576
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
REJECT ROWS WITH ALL NULL FIELDS
(
"EMPLOYEE_ID" CHAR(255)
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"',
"ENAME" CHAR(255)
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"',
"JOB" CHAR(255)
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"',
"HIRE_DATE" CHAR(255)
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"',
"SAL" CHAR(255)
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"',
"COMM" CHAR(255)
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"',
"DEPTNO" CHAR(255)
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
)
)
location
(
'datafile.txt'
)
)
我已經讀/寫權限到外部目錄。
表已創建。當我嘗試做從「emp_ext」 SELECT *,我得到以下錯誤
SQL> select * from "emp_ext";
select * from "emp_ext"
*
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04043: table column not found in external source: EMPNO
ORA-06512: at "SYS.ORACLE_LOADER", line 19
錯誤消息看起來很清楚,不是嗎?這個datefile.txt的樣本在哪裏?表定義中有EMPNO,但文件的行/列定義中有EMPLOYEE_ID。 – OldProgrammer