Home » SQL & PL/SQL » SQL & PL/SQL » Exception PLSQL (10g)
Exception PLSQL [message #358446] Tue, 11 November 2008 06:38 Go to next message
deep_kol
Messages: 5
Registered: November 2008
Junior Member
Hi Frnds,

Is it possible ?
As we know OTHER must be once in the exception block .

Declare
begin

Exception
when others then
declare
begin
exception
when others then
statement ;
end;
end;
Re: Exception PLSQL [message #358451 is a reply to message #358446] Tue, 11 November 2008 07:16 Go to previous messageGo to next message
Littlefoot
Messages: 20895
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
As we know OTHER must be once in the exception block .
In my opinion, this is wrong. It doesn't have to; why would it?

Quote:
Is it possible ?
Try and you'll know.
Re: Exception PLSQL [message #358453 is a reply to message #358451] Tue, 11 November 2008 07:24 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Quote:
As we know OTHER must be once in the exception block .

No , but if "when others" is used within the exception block,
do always follow it by logging the error and/or use raise or raise_application_error
Re: Exception PLSQL [message #358557 is a reply to message #358446] Tue, 11 November 2008 20:27 Go to previous messageGo to next message
deep_kol
Messages: 5
Registered: November 2008
Junior Member
Then Can we write more than once OTHER in exception block ?

Declare
begin
exception
when OTHER then
stament1 ;
when OTHER then
stament2 ;
END;
Re: Exception PLSQL [message #358582 is a reply to message #358446] Tue, 11 November 2008 21:57 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

Isn't it simple to try it out yourself ?

BTW, there is no exception called OTHER . it is OTHERS

SQL> begin
  2   NULL;
  3  exception
  4  when NO_DATA_FOUND then
  5   NULL;
  6  when OTHERS then
  7   NULL;
  8  END;
  9  /

PL/SQL procedure successfully completed.

SQL> begin
  2   NULL;
  3  exception
  4  when OTHERS then
  5   NULL;
  6  when OTHERS then
  7   NULL;
  8  END;
  9  /
when OTHERS then
*
ERROR at line 4:
ORA-06550: line 4, column 1:
PLS-00370: OTHERS handler must be last among the exception handlers of a block
ORA-06550: line 0, column 0:
PL/SQL: Compilation unit analysis terminated


SQL>


Smile
Rajuvan.
Re: Exception PLSQL [message #358657 is a reply to message #358582] Wed, 12 November 2008 01:38 Go to previous message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

I wonder..
Why do you want to this ???
Previous Topic: Reading mail from outlook
Next Topic: 2 rows contain same values but different columns
Goto Forum:
  


Current Time: Tue Dec 06 00:26:49 CST 2016

Total time taken to generate the page: 0.06385 seconds