Home » SQL & PL/SQL » SQL & PL/SQL » Continous Execution after Exception Handling (Oracle 10g, Release 10.2.0.1.0, Windows XP)
Continous Execution after Exception Handling [message #340475] Wed, 13 August 2008 01:24 Go to next message
senthil.gts
Messages: 3
Registered: August 2008
Junior Member
Dear Members,

Kindly help me out in the following scenarion.

In a PL/SQL block, there are 1000 lines.
If any exception is been raised in any of the lines. Then how can i continue the program control from the next line where the exception got raised.

Thanks in advance.
Re: Continous Execution after Exception Handling [message #340482 is a reply to message #340475] Wed, 13 August 2008 01:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Do you want to ignore all errors? What if the error means you are disconnected? Do you want to get/ignore the error at each line? If you ignore the errors how do you know what has been done and what was not?

What is your real need?

Regards
Michel
Re: Continous Execution after Exception Handling [message #340520 is a reply to message #340482] Wed, 13 August 2008 03:08 Go to previous messageGo to next message
senthil.gts
Messages: 3
Registered: August 2008
Junior Member
Dear Michel,

As you said i want to ignore all the errors. I just want to know any provision is there in oracle for this requirement.

Also i agree the case which u have discussed, where ignoring errors is of no use.

But, Consider the following scenario

declare
i number;
j number;
k number;
begin
insert into x values ('a'); -- line 1
i := 1; -- line 2
insert into x values ('b'); -- line 3
j := 0; -- line 4
insert into x values ('c'); -- line 5
k := i/j; -- line 6
insert into x values ('d'); -- line 7
end;

Here i want the program control to execute line 7, in fact of the exception in line 6. One solution is, if i make line 6 as separate anonymous block with exception block, then line 7 can be executed. But say if there are n number of lines and any line can cause any error i can't have n number of anonymous blocks, can the program control could travel till the end of the block. Is there any provision for this in oracle.
Kindly suggest.

Thanks,
Senthil
Re: Continous Execution after Exception Handling [message #340522 is a reply to message #340520] Wed, 13 August 2008 03:13 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
No, there is no provision in Oracle for ignoring all exceptions.
Re: Continous Execution after Exception Handling [message #340529 is a reply to message #340520] Wed, 13 August 2008 03:40 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
What about if line 7 or followings use result from line 6? All your results and data are wrong!

You MUST ignore ONLY the errors you expect or can handle not every error on every line.
So you have to use a different block each time.

Regards
Michel
Re: Continous Execution after Exception Handling [message #340606 is a reply to message #340475] Wed, 13 August 2008 06:59 Go to previous message
senthil.gts
Messages: 3
Registered: August 2008
Junior Member
Dear Micheal, Thanks for your kind support.
Previous Topic: FORALL INSERT loop break conditionally
Next Topic: List of the months according to current date
Goto Forum:
  


Current Time: Tue Feb 18 21:04:03 CST 2025