Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

trying to test a run time error

636309Aug 16 2011 — edited Aug 17 2011
Hello,

Oracle 11g Enterprise Edition Release 11.2.0.1.0 - 64bit

Could you please help me figure out how to test the EXCEPTION handling section of my code? I want to try to force errors for each statement so that it hits the EXCEPTION handler section and logs the error. Here is a simplified version of the code (tables a and b have the same datatype): Thanks!

declare
cursor c1 is
select col1, col2 from tablea
minus
select col1, col2 from tableb;
type aaa is table of c1%rowtype;
bbb aaa;
begin
open c1;
fetch c1 bulk collect into bbb;
forall i in bbb.first .. bbb.last
update tableb
set col2 = bbb(i).col2
where col1 = bbb(i).col1
close c1;
exception
when other then
log('there was an error');
end;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 14 2011
Added on Aug 16 2011
5 comments
379 views