I am trying to debug a DML error that is happening in one environment, but not others. The set up is this:
我有大约10套DML业务(从遥远的桌旁推到散装到当地桌上),其中2套给DML差错,“印数”fl,另一套是“PL/SQL:数字或数值错误:Bulk Bind:Truncated Bind”。
我尝试将数据复制到“良好”环境,不能复制同样的错误。 因此,我现在试图建立更强大的错误手,以赶上这些错误,并帮助确定哪些数据给我带来问题。
我期望:
...
loop
fetch c_some_data bulk collect into v_arr limit v_limit_size;
forall i in 1..v_arr.count SAVE EXCEPTIONS
insert into table_abc_1 values v_arr(i);
exit when c_some_data%notfound;
end loop;
...
exception
when X_DML_ERRORS then
declare
j integer;
begin
FOR j IN 1 .. SQL%BULK_EXCEPTIONS.COUNT LOOP
begin
/*only print the KEY fields for this table,
this table has (I think) close to 20 fields*/
dbms_output.put_line( DML Bulk-operation error: ||
Error Code: ||SQLERRM(-SQL%BULK_EXCEPTIONS(j).ERROR_CODE)|| ; ||
v_arr(SQL%BULK_EXCEPTIONS(j).ERROR_INDEX).stage|| ; ||
v_arr(SQL%BULK_EXCEPTIONS(j).ERROR_INDEX).id|| ; ||
v_arr(SQL%BULK_EXCEPTIONS(j).ERROR_INDEX).code|| ; )
end;
end loop;
end;
when others then
PKG_EXCPTN.sp_generic_exception_handler;
end;
I m sure I could just print all of the columns, but the tables are large (some with > 20 columns) and there are 10 blocks of code that could potentially have this problem. It would also require someone to look at each value in the message and see if it matches with the column type (varchar2 vs. number).
是否容易印刷错误发生地和造成错误的价值?
(使用Oracle 10g)