我正在尝试创建外部表,但我收到错误。
以下是用于创建外部表的代码,
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'
)
)
我对外部目录具有READ / WRITE权限。
表已创建。当我尝试从“emp_ext”中选择*时,我得到以下错误
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
答案 0 :(得分:0)
CREATE TABLE
中指定的第一个字段是EMPNO
,但记录定义中指定的第一个字段是EMPLOYEE_ID
。这些必须匹配。选择其中一个。
祝你好运。
答案 1 :(得分:0)
我猜你应该改变
"EMPLOYEE_ID" CHAR(255)
的
"EMPNO" CHAR(255)
MGR数据来自何处?