SQL> create table myTable (
2 x number not null );
Table created.
SQL>
SQL> set serverout on
SQL> declare
2 type numlist is table of number
3 index by binary_integer;
4 n numlist;
5 begin
6 for i in 1 .. 50 loop
7 n(i) := i;
8 end loop;
9
10 n(37) := null; -- will cause a problem
11
12 forall i in 1 .. 50 save exceptions
13 insert into myTable values (n(i));
14
15 exception when others then
16 dbms_output.put_line('Errors:'||sql%bulk_exceptions.count);
17 for i in 1 .. sql%bulk_exceptions.count loop
18 dbms_output.put_line('index:'||sql%bulk_exceptions(i).error_index);
19 dbms_output.put_line('code:'||sql%bulk_exceptions(i).error_code);
20 dbms_output.put_line('message:');
21 dbms_output.put_line(sqlerrm(sql%bulk_exceptions(i).error_code));
22 end loop;
23 end;
24 /
Errors:1
index:37
code:1400
message:
-1400: non-ORACLE exception
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL> drop table myTable;
Table dropped.
|