创建外部表时,ORA-30657以及 返回0行数据

今天把数据导入另外一个库时,通过外部表的形式,具体怎么创建 见 :oracle 创建外部表实例演示https://blog.csdn.net/whandgdh/article/details/89381072
创建外部表数据代码如下:

create table grbillin_ext
(
  genbillno   VARCHAR2(36) not null   ,
  riskcode    VARCHAR2(8)  ,
  comcode     VARCHAR2(24) ,
  feetype     VARCHAR2(6)  ,
  billtype    VARCHAR2(4),
  ttyid       VARCHAR2(18)  ,
  ttycode     VARCHAR2(10),
  uwyear      NUMBER(4)  ,
  calsign     NUMBER(1),
  accym       VARCHAR2(12)  ,
  duedate     DATE   ,
  currency    VARCHAR2(6)  ,
  sumfee      NUMBER(16,2) ,
  businessind VARCHAR2(2)  ,
  accchannel  VARCHAR2(40)  ,
  plancode    VARCHAR2(8)  ,
  reinscode   VARCHAR2(24),
  brokercode  VARCHAR2(24),
  paycode     VARCHAR2(24),
  taxind      VARCHAR2(2)
)
organization external  
(
type ORACLE_LOADER   
default directory ext_data_dir  
access parameters(
records delimited by newline   
badfile ext_bad_dir :'grbillin%a_%p.bad'   
logfile ext_log_dir :'grbillin%a_%p.log'  
  fields terminated by ','    
missing field values are null
( genbillno    ,
  riskcode    ,
  comcode     ,
  feetype     ,
  billtype    ,
  ttyid       ,
  ttycode     ,
  uwyear      ,
  calsign     ,
  accym       ,
  duedate       ,
  currency    ,
  sumfee      ,
  businessind ,
  accchannel  ,
  plancode    ,
  reinscode   ,
  brokercode  ,
  paycode     ,
  taxind       )
)
location ('grbillin.dat')   
)
parallel
reject limit unlimited; 

但是 居然提示 ORA-30657: 操作在外部组织表上不受支持

在这里插入图片描述
把创建语句检查了很多变,一致没发现问题,但是后面发现报错的时候,光标会停留在 genbillno VARCHAR2(36) not null , 上,想到外部表不能进行DML操作,那是不是费控约束这些也不允许。
就把not null删除 ,创建成功。

但是查询外部表时不能获取到数据,找到创建外部表时的日志目录,并打开日志看到
在这里插入图片描述

从日志中看到 duedate 列由于是日期,转换时报错,
所以需要把建表语句中转换字段 duedate 改为 dudate DATE “YYYY-MM-DD”

missing field values are null
( genbillno    ,
  riskcode    ,
  comcode     ,
  feetype     ,
  billtype    ,
  ttyid       ,
  ttycode     ,
  uwyear      ,
  calsign     ,
  accym       ,
  duedate   DATE  "YYYY-MM-DD"       ,
  currency    ,
  sumfee      ,
  businessind ,
  accchannel  ,
  plancode    ,
  reinscode   ,
  brokercode  ,
  paycode     ,
  taxind       )

然后重建外部表,成功获取数据
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

菜菜的中年程序猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值