Home » SQL & PL/SQL » SQL & PL/SQL » Whats the oracle equivalent for finally used in C#
Whats the oracle equivalent for finally used in C# [message #167596] Fri, 14 April 2006 06:25 Go to next message
captainjacksparro
Messages: 6
Registered: April 2006
Junior Member
Hi

can anybody tell whats the oracle equivalent for Finally statement used in C#.NET
try/catch/finally.

I have used custom exception in Oracle stored procedure and there is some code that is common to all the exceptions. So i want to use finally statement.

Thanks
Sonu
Re: Whats the oracle equivalent for finally used in C# [message #167609 is a reply to message #167596] Fri, 14 April 2006 09:20 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
That would be the "when others" exception clause.
Re: Whats the oracle equivalent for finally used in C# [message #167665 is a reply to message #167596] Sat, 15 April 2006 02:24 Go to previous messageGo to next message
captainjacksparro
Messages: 6
Registered: April 2006
Junior Member
Well "when others" is used for exception , i am talking of some other statement like finally which is always executed.

I have used soo many exception

Exception
WHEN EXCEPTION1 then do something
WHEN EXCEPTION2 then do something
WHEN EXCEPTION3 then do something
now after all the exceptions i want Oracle equivalent for finally (in C#.NET or C++ or java), there is some code that is common to all the exception , so i want to use something like finally.
Re: Whats the oracle equivalent for finally used in C# [message #167709 is a reply to message #167665] Sat, 15 April 2006 10:18 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
As far as I know there is no such thing. To achieve the same result, you could nest your blocks.
begin
  begin
    do_this;
  exception
    when e_error1
    then
      do_err1;
    when others
    then
      do_oth;
  end;

  do_your_finally;
end;


do_your_finally will be executed regardless of any error (if any).
Is this what you are looking for?

[Edit: added more explanation]

[Updated on: Sat, 15 April 2006 10:20]

Report message to a moderator

Re: Whats the oracle equivalent for finally used in C# [message #168007 is a reply to message #167709] Tue, 18 April 2006 06:30 Go to previous message
captainjacksparro
Messages: 6
Registered: April 2006
Junior Member
Thanks , i got its Very Happy

actually thers some code in all the exceptions handlers that is common that i have to execute in any case , so i'll have to take it to end.

Thanks frank
Previous Topic: Date Conversion
Next Topic: Email with attachments using PL\SQL.
Goto Forum:
  


Current Time: Sun Apr 27 06:52:28 CDT 2025