保存异常未捕获ORA-01438 的完整错误描述:值大于此列允许的指定精度,它仅抛出一般错误,未捕获列名和大小。任何解决方法都可以与此代码集成以获取与错误相关的完整列描述?
create or replace procedure BULK_COLLECT_TEST_PROC
as
TYPE t_bulk_collect_test_tab IS TABLE OF bulk_collect_test%ROWTYPE;
l_tab t_bulk_collect_test_tab;
l_error_count NUMBER;
ex_dml_errors EXCEPTION;
PRAGMA EXCEPTION_INIT(ex_dml_errors, -24381);
CURSOR c_data IS
SELECT *
FROM bulk_collect_test;
BEGIN
OPEN c_data;
LOOP
FETCH c_data
BULK COLLECT INTO l_tab LIMIT 10000;
EXIT WHEN l_tab.count = 0;
-- Perform a bulk operation.
BEGIN
FORALL i IN l_tab.first .. l_tab.last SAVE EXCEPTIONS
INSERT INTO exception_test
VALUES l_tab(i);
EXCEPTION
WHEN ex_dml_errors THEN
l_error_count := SQL%BULK_EXCEPTIONS.count;
DBMS_OUTPUT.put_line('Number of failures: ' || l_error_count);
FOR i IN 1 .. l_error_count LOOP
DBMS_OUTPUT.put_line('Error: ' || i ||
' Array Index: ' || SQL%BULK_EXCEPTIONS(i).error_index ||
' Message: ' || SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
END LOOP;
END;
END LOOP;
END;
/
SET SERVEROUTPUT ON;
EXEC BULK_COLLECT_TEST_PROC;
Number of failures: 9001
Error: 1 Array Index: 1000 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 2 Array Index: 1001 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 3 Array Index: 1002 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 4 Array Index: 1003 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 5 Array Index: 1004 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 6 Array Index: 1005 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 7 Array Index: 1006 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 8 Array Index: 1007 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 9 Array Index: 1008 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 10 Array Index: 1009 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 11 Array Index: 1010 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 12 Array Index: 1011 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 13 Array Index: 1012 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 14 Array Index: 1013 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 15 Array Index: 1014 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 16 Array Index: 1015 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 17 Array Index: 1016 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 18 Array Index: 1017 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 19 Array Index: 1018 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 20 Array Index: 1019 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 21 Array Index: 1020 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 22 Array Index: 1021 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 23 Array Index: 1022 Message: ORA-01438: value larger than specified precision allowed for
this column
Error: 24 Array Index: 1023 Message: ORA-01438: value larger than specified precision allowed for
this column