Home » SQL & PL/SQL » SQL & PL/SQL » delete exception
delete exception [message #35429] Thu, 10 February 2005 03:49 Go to next message
pandian
Messages: 31
Registered: December 2004
Member
while deleteing a record thru plsql it does not show the no_data_found exception if no record exist for deletion

how can we catch that exception
plz help
pandian
Re: delete exception [message #35430 is a reply to message #35429] Thu, 10 February 2005 04:04 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
This is not an exception.
You can check whether sql%rowcount = 0.

hth
Re: delete exception [message #35431 is a reply to message #35429] Thu, 10 February 2005 04:04 Go to previous messageGo to next message
anil sinare
Messages: 61
Registered: November 2004
Location: pune
Member

Hi,

use SQL%ROWCOUNT to catch this.
I mean if SQL%ROWCOUNT > 0 then Records deleted
else No record deleted.

Thanks and Regards
Anil Sinare
Re: delete exception [message #35432 is a reply to message #35429] Thu, 10 February 2005 04:10 Go to previous message
Sreedhar Reddy
Messages: 55
Registered: January 2002
Member
check the below anonymous procedure

SQL> declare
2 begin
3 execute immediate 'delete from sample where id=111';
4 dbms_output.put_line(sql%rowcount||' Records Deleted');
5 end;
6 /
0 Records Deleted

PL/SQL procedure successfully completed.

SQL> declare
2 begin
3 execute immediate 'delete from sample where id=1';
4 dbms_output.put_line(sql%rowcount||' Rocords Deleted');
5 end;
6 /
1 Rocords Deleted

PL/SQL procedure successfully completed.
Previous Topic: URGENT pls help me.
Next Topic: SQL Looping question II
Goto Forum:
  


Current Time: Thu Apr 24 23:33:43 CDT 2025