小弟有一个存储过程,是从一系列表中将数据导入his表中。 目前在跑的过程中出错回滚了。
后来经查明,是执行到这一句时出错的 insert into base_Msg_Out_his select * from base_Msg_Out where id < baseMsgOutId;
其中 baseMsgOutId是上面查询的一个变量。
base_Msg_Out_his ,base_Msg_Out 这两个表结构是一样的。
小弟单独将 这个语句拿出来执行,提示 什么 too large for the column (大概就是这样子)
应该是说哪一个字段超长了吧。
小弟该如何找出这些坏数据?谢谢!
后来经查明,是执行到这一句时出错的 insert into base_Msg_Out_his select * from base_Msg_Out where id < baseMsgOutId;
其中 baseMsgOutId是上面查询的一个变量。
base_Msg_Out_his ,base_Msg_Out 这两个表结构是一样的。
小弟单独将 这个语句拿出来执行,提示 什么 too large for the column (大概就是这样子)
应该是说哪一个字段超长了吧。
小弟该如何找出这些坏数据?谢谢!
你确定表结构一样?
select a.table_name,a.column_name,a.data_type,a.data_length,
b.data_type,b.data_length from all_tab_cols a,all_tab_cols b
where a.table_name=b.table_name
and a.column_name=b.column_name
and a.table_name=upper('base_Msg_Out_his')
and b.table_name=upper('base_Msg_Out')比较一下长度定义是否相同
如果不能排除是别的insert语句上出的错
将别的表也和base_msg_out_his表比较一下
b.data_type ,b.data_length
from all_tab_cols a,
all_tab_cols b
where a.column_name=b.column_name
and a.table_name=upper('base_Msg_Out_his')
and b.table_name=upper('base_Msg_Out')
应是这样写吧 a.table_name=b.table_name 这个条件写多了,where 最后2个条件是不等的,出不了结果在最后加一铝: and a.data_length<>b.data_length; 似乎找到结果了。呵呵,我拿来主义,拿wildwave成果
from base_Msg_Out_his
where length(base_Msg_Out_his.知了长了的列名)>base_Msg_Out_该列长;就可以找到超长了的记录
或者 dml error logging