Home » SQL & PL/SQL » SQL & PL/SQL » PL/SQL code to ignore WHEN NO_DATA_FOUND exception
PL/SQL code to ignore WHEN NO_DATA_FOUND exception [message #6877] Fri, 09 May 2003 10:41 Go to next message
Asare
Messages: 1
Registered: May 2003
Junior Member
:
:
BEGIN

OPEN all_DDN_VOL_NUM;

LOOP
counter := counter + 1;

call some stored procedures
if (MOD(counter,100) = 0) then
commit;
end if;

END LOOP;

commit;

CLOSE all_DDN_VOL_NUM;

EXCEPTION
WHEN NO_DATA_FOUND THEN
DO NOTHING
WHEN OTHERS THEN
raise_application_error(-20000, SQLERRM);
END PurgeAllTables;

I would like the loop to ignore WHEN NO_DATA_FOUND exception continue processing. For any other exception return an error code with error message.
Re: PL/SQL code to ignore WHEN NO_DATA_FOUND exception [message #6880 is a reply to message #6877] Fri, 09 May 2003 12:22 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
begin
  for r in open all_ddn_vol_num loop
    begin
      -- procedure calls
    exception
      when no_data_found then
        null;
      when others then
        raise;
    end;  
  end loop;
exception
  when others then
    raise_application_error(-20000, sqlerrm);
end;
Previous Topic: to know user
Next Topic: comparing like fields in same table
Goto Forum:
  


Current Time: Tue Apr 23 18:03:43 CDT 2024