Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
There are large benefits to had from bulk binding. But one area where extra care is required is in error handling. In a development model where rows are modified on a row-at-a-time basis, when a SQL statement fails with an error, the erroneous row in question is implicit—it’s the row you are working with. For example, in the following simple PL/SQL block (bulk_error_1.sql) with two insert statements, it is obvious which insert statement is the problem one:
SQL> alter table hardware
2 add constraint
3 hardware_chk check ( item > 0 );
Table altered.
SQL> begin
2 insert into hardware ( item ) values (1);
3 insert into hardware ( item ) values (-1);
4 insert into hardware ( item ) values (2);
5 insert into hardware ( item ) values (3);
6 insert into hardware ( item ) values (4);
7 insert into hardware ( item ) values (-2);
8 end;
9 /
begin
*
ERROR at line 1:
ORA-02290: check constraint (MCDONAC.HARDWARE_CHK) violated
ORA-06512: at line 3