我使用.tbl文件创建了一个外部表,如下所示:
CREATE TABLE orders_load ( O_ORDERKEY INTEGER ,
O_CUSTKEY INTEGER ,
O_ORDERSTATUS CHAR(1) ,
O_TOTALPRICE DECIMAL(15,2),
O_ORDERDATE DATE,
O_ORDERPRIORITY CHAR(15),
O_CLERK CHAR(15),
O_SHIPPRIORITY INTEGER,
O_COMMENT VARCHAR(79))
organization external
(default directory user_directory
access parameters
(fields terminated by '|')
location('orders.tbl')
);
然后,为了从该表中选择所有行,我使用了:
select * from users_load;
但我收到了这个错误:
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-30653: reject limit reached
然后使用下面的命令,上面的错误似乎已修复:
alter table users_load reject limit unlimited;
现在,当我执行此命令时
选择* from users_load;
我没有收到任何错误,但我得到的结果是:"没有选择行"。
(orders.tbl文件有超过10.000.000行)
每行的格式为:
34155110|847435|O|190135.67|1998-04-21|4-NOT SPECIFIED|Clerk#000005134|0|posits wake quickly according to the car|
在日志文件中显示为:ORA-01861 Literal does not match format string for column O_ORDERDATE.
答案 0 :(得分:3)
您需要指定DATE
列的格式。
像这样的东西(现在不能测试)
CREATE TABLE orders_load ( O_ORDERKEY INTEGER ,
O_CUSTKEY INTEGER ,
O_ORDERSTATUS CHAR(1) ,
O_TOTALPRICE DECIMAL(15,2),
O_ORDERDATE DATE,
O_ORDERPRIORITY CHAR(15),
O_CLERK CHAR(15),
O_SHIPPRIORITY INTEGER,
O_COMMENT VARCHAR(79))
organization external
(
default directory user_directory
access parameters
(
fields terminated by '|'
(
O_ORDERKEY,
O_CUSTKEY,
O_ORDERSTATUS,
O_TOTALPRICE,
O_ORDERDATE DATE "YYYY-MM-DD", -- this needs to be in the format of your input file
O_ORDERPRIORITY,
O_CLERK,
O_SHIPPRIORITY,
O_COMMENT
)
)
location('orders.tbl')
);
根据我的经验,只需要为DATE
列定义格式,对于所有其他列(特别是数字),Oracle会毫无问题地找到它。