Home » Developer & Programmer » Designer » when others probs
when others probs [message #90437] Sat, 20 September 2003 10:02 Go to next message
Prasad Kumar
Messages: 4
Registered: August 2002
Junior Member
Hi,
I have a program

declare

exception myexception;
mynum number;
begin

select a into mynum from table_name;

if mynum>1000 then
raise myexception;
end if;

exception

when too_many_rows then
--- do some thing
when others then
--- do some thing
when myexception then
-- do some thing
end;

Kindly tell me what happens to my code.
Will it go to when others or myexception
Re: when others probs [message #90439 is a reply to message #90437] Mon, 22 September 2003 02:08 Go to previous message
R.Satish Kumar
Messages: 14
Registered: August 2003
Junior Member
Declare
mynum number;
myexception exception;
begin
select a into mynum from table_name;
if mynum>1000 then
raise myexception;
end if;
exception
when too_many_rows then
dbms_output.put_line('Too_many_rows');
when myexception then
dbms_output.put_line('Greater than 1000');
when others then
dbms_output.put_line('Whenothers');
end;
/

when others exception should be the last among the other exceptions. When all the other exception fails including the userdefined then it goes for when others.

Hope this might help you.
Previous Topic: Design Advice
Next Topic: : when others probs thanks but some more clarification
Goto Forum:
  


Current Time: Thu Apr 24 15:26:43 CDT 2014

Total time taken to generate the page: 0.08726 seconds