Home » SQL & PL/SQL » SQL & PL/SQL » when NO_DATA_FOUND not carry on ???
when NO_DATA_FOUND not carry on ??? [message #185199] Mon, 31 July 2006 08:27 Go to next message
mape
Messages: 241
Registered: July 2006
Location: Slovakia
Senior Member
Hello

I dont know why my program will not carry on
if not_data_found ?
Does anybody know where is the problem?

thanks

cursor l_list is select * from mape;

BEGIN

for i in l_list LOOP
    
 BEGIN

   SELECT 1 into v_exist0_b
                    from table_site eu,table_bus_org cu
                    where eu.objid=i.su_site_part2site  
                    and cu.objid=eu.x_site2customer 
                    and cu.x_bus_org2billcycle=268451297;
   IF (v_exist0_b=1) 

THEN
       dbms_output.put_line(i.x_external_id);

   end if;

exception
  when no_data_found then
   raise no_data_found;
    
 END;

end loop;

 

EXCEPTION
  WHEN OTHERS
      THEN
         DBMS_OUTPUT.put_line (v_error_message);
 
end;

[Updated on: Mon, 31 July 2006 08:28]

Report message to a moderator

Re: when NO_DATA_FOUND not carry on ??? [message #185206 is a reply to message #185199] Mon, 31 July 2006 09:00 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member


Try with ....

................
................
BEGIN

   SELECT 1 into v_exist0_b
                    from table_site eu,table_bus_org cu
                    where eu.objid=i.su_site_part2site  
                    and cu.objid=eu.x_site2customer 
                    and cu.x_bus_org2billcycle=268451297;
   IF (v_exist0_b=1) 

THEN
       dbms_output.put_line(i.x_external_id);

   end if;

exception
  when no_data_found then
   raise no_data_found;
    
 END;
................
.........


Thumbs Up
Rajuvan.

Re: when NO_DATA_FOUND not carry on ??? [message #185230 is a reply to message #185206] Mon, 31 July 2006 11:41 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Rajuvan, do I not see well, but your code is exactly the same as the OP's one?!?

Mape, if I understood you well, you'd want your code to continue even though NO-DATA-FOUND error occurs? If so, don't RAISE an exceptiion - do nothing instead:

EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
Re: when NO_DATA_FOUND not carry on ??? [message #185289 is a reply to message #185230] Tue, 01 August 2006 00:46 Go to previous message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

OOOOOooops ,

Even I tried to mean...

EXCEPTION
WHEN NO_DATA_FOUND THEN 
NULL;


But I forgot to make change in the code ..

@ OP :

You code raises exception Because you are raising the exception again on capturing the NO_DATA_FOUND exception eventually it goes Out of the block.

Thumbs Up
Rajuvan

[Updated on: Tue, 01 August 2006 00:46]

Report message to a moderator

Previous Topic: how to change the default tab value
Next Topic: Table Indexes
Goto Forum:
  


Current Time: Sun Dec 04 23:10:22 CST 2016

Total time taken to generate the page: 0.04919 seconds