日期:2014-05-16  浏览次数:20496 次

insert 报错,求助
我想取一批学生基本信息中电话号码长度大于11位和为空的数据,我不想用or,用union
执行的时候报错,指向union ,如果 我不加insert into lw,后面语句执行都是正常的。麻烦大虾看看啥原因。
insert into lw   
select * from (select first 1 a.id,a.ddtime from hf a,stu b where  
a.stuid=b.stuid and  a.ddtime between '03/01/2014' and '04/08/2014' and  length(a.tel)>11)   
union
 select * from (select first 1 a.id,a.ddtime from hf a,stu b where  
a.stuid=b.stuid and  a.ddtime between '03/01/2014' and '04/08/2014' and  a.tel='')
------解决方案--------------------
初步怀疑可能是:select * from (select first 1 a.id,a.ddtime from hf a,stu b where  
a.stuid=b.stuid and  a.ddtime between '03/01/2014' and '04/08/2014' and  length(a.tel)>11)   
union
 select * from (select first 1 a.id,a.ddtime from hf a,stu b where  
a.stuid=b.stuid and  a.ddtime between '03/01/2014' and '04/08/2014' and  a.tel='')这个查询出来的结果集跟目标表“lw”对应的列不匹配