PL/SQL Exception Handling [message #37282] |
Tue, 29 January 2002 03:35 |
bill
Messages: 75 Registered: November 1999
|
Member |
|
|
Hoping someone can show me the light.
I have a block which opens a cursor, loops thru the cursor and inserts the values into a table. I have an exception handler for DUP_VAL_ON_INDEX. These duplicate records are to be inserted into a discard table.
The problem:
When the exception is raised the loop is exited and only the first record from the cursor is inserted into the discard table. I tried inserting another block containing just the exception handling into the block containing the loop but I am getting errors.
I just need a way to raise the exception insert the record and then continue from the point the exception was raised.
- Bill
|
|
|
Re: PL/SQL Exception Handling [message #37283 is a reply to message #37282] |
Tue, 29 January 2002 03:44 |
pratap kumar tripathy
Messages: 660 Registered: January 2002
|
Senior Member |
|
|
Hi,
try this way
------------------------
declare
cursor xyz_cur is
your query goes here......;
begin
for tmp in xyz_cur
loop
begin
insert into desired_table;
exeception
when dup_val_on_index then
insert into discard_table.........;
end;
end loop;
end;
------------------------
Hope it helps!!!
cheers
pratap
|
|
|
|