Home » SQL & PL/SQL » SQL & PL/SQL » Exceptions
Exceptions [message #227046] Tue, 27 March 2007 03:43 Go to next message
subramanian.sp
Messages: 13
Registered: March 2007
Location: Pune
Junior Member
Consider that my pl/sql block having 100 select statements.
In that case if i want to handle the exception like no_data_found , i have to handle the exception for each select statement .so 100 exception block for 100 select statement.
is there any other way to do this code simpple?
Re: Exceptions [message #227048 is a reply to message #227046] Tue, 27 March 2007 03:49 Go to previous messageGo to next message
shanthkumaar
Messages: 156
Registered: February 2007
Location: india,chennai
Senior Member

hi,

i suppose, you are asking for when others



regards
shanth
Re: Exceptions [message #227050 is a reply to message #227046] Tue, 27 March 2007 03:49 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can do something like:

declare
  whereami pls_intege := 0;
begin
  insert into ...
  whereami := 1;
  insert into ...
  whereami := 2;
  insert into ...
  whereami := 3;
  ...
exception
  when no_data_found then
     <doing something depending on whereami value>


Regards
Michel
Re: Exceptions [message #227053 is a reply to message #227050] Tue, 27 March 2007 03:51 Go to previous messageGo to next message
shanthkumaar
Messages: 156
Registered: February 2007
Location: india,chennai
Senior Member

hi,

then sorry i got it wrong Embarassed
Re: Exceptions [message #227064 is a reply to message #227050] Tue, 27 March 2007 04:23 Go to previous messageGo to next message
subramanian.sp
Messages: 13
Registered: March 2007
Location: Pune
Junior Member
In this case if any exception raised at 2nd stmt then it will goes to exception when others block,after that pl/sql wont execute 3rd and further stmt . what to do in that case?
Re: Exceptions [message #227073 is a reply to message #227064] Tue, 27 March 2007 04:39 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I don't know.
Finally, what do you want to do?
To ignore no data found?
To handle it in another way?

Regards
Michel
Previous Topic: Select lower 5 and upper 5 records!!
Next Topic: Finding how much time a procedure takes...without having access to the code of the procedure!
Goto Forum:
  


Current Time: Sat Dec 10 04:48:12 CST 2016

Total time taken to generate the page: 0.08967 seconds