test window hiding ORA-24381: error(s) in array DML

Worker

Member³
Running the following in a test window should result in an exception. Instead, there is no exception and I think an automatic rollback is issued.

Code:
declare
	string_array owa_text.vc_arr;
begin

	string_array(1) := 'the same value twice';
	string_array(2) := 'the same value twice';

	begin

		FORALL	i
		IN INDICES OF string_array
		SAVE EXCEPTIONS
		INSERT
		INTO	MY_TABLE
		(	name,
			value )
		VALUES
		(	string_array(i),
			'test' );

--	exception when others then
--		dbms_output.put_line(sqlerrm);

	end;

end;

You will need to replace "MY_TABLE" with some test table of your own. In this case "name" needs to be a primary key of the table.

If you uncomment the two lines you will see that an exception does indeed happen: "ORA-24381: error(s) in array DML". This is because of the "SAVE EXCEPTIONS" part of the "FORALL" statement. For some reason PL/SQL Developer is handling that exception and hiding it from the user.
 
It seems that ORA-24381 is reported as a warning from this anonymous PL/SQL Block, and not as an error. We'll enhance this.
 
Back
Top