ztj111 发表于 2011-08-25 13:03

informix中update语句报错

create temp table shh
(
bankcode CHAR(12),
BusinessCode      CHAR(15)
)
with no log;

load from jf1.unl delimiter '|'
insert into shh;

update prpjfcombus set bankcode=
(select a.bankcode from shh a
where a.BusinessCode=prpjfcombus.BusinessCode
    );

运行上面语句报错:
391: Cannot insert a null into column (prpjfcombus.bankcode).
Error in line 4
Near character position 4

麻烦大家帮忙分析一下。

jf1.unl:
0801025500|898430159600500
0801025500|898430159604401
0801025500|898430159604501
0801025500|898430159604601
0801025500|898430159604701
0801025500|898430159604801
0801025500|898430159604901
0801025500|898430159605001
0801025500|898430159605101
0801025500|898430159605201
0801025500|898430159605301
0801025500|898430159605401
0801025500|898430163000234
0801025500|898430163000235
0801025500|898430163000236
0801025500|898430163000237
0801025500|898430163000238
0801025500|898430292231488
0801025500|898430163000239
0801025500|898430163000240
0801025500|898430163000241
0801025500|898430163000242
0801025500|898430163000243
0801025500|898430163000244
0801025500|898430163000267
0801025500|898430192230169
0801025500|898430359601506
0801025500|898430359601504
0801025500|898430359601500
0801025500|898430292231497
0801025500|898430292231491
0801025500|898430192230170
0801025500|898430192230171

ztj111 发表于 2011-08-25 13:06

prpjfcombus表的结构
prpjfcombus
(
ComCode        CHAR(8) NOT NULL,       
BusinessCode        CHAR(15) NOT NULL,       
BusinessName        CHAR(40) NOT NULL,       
BankCode        CHAR(12) NOT NULL,       
Flag        CHAR(10),       
);

mujian1986 发表于 2011-08-25 15:47

update prpjfcombus set bankcode=
(select a.bankcode from shh a
where a.BusinessCode=prpjfcombus.BusinessCode
    )
where BusinessCode in(select BusinessCode from shh);

ztj111 发表于 2011-08-25 16:13

这样是可以的

renxiao2003 发表于 2011-08-27 22:45

空限制啊。你的列有不允许空的。
页: [1]
查看完整版本: informix中update语句报错