Home » SQL & PL/SQL » SQL & PL/SQL » Update
Update [message #37721] Mon, 25 February 2002 00:15 Go to next message
diaz
Messages: 58
Registered: October 2001
Member
hi,
how can we manage if the update is returning 0 rows ?
which mean the syntax is not wrong.. but it can't find the specified item that wanted to be updated

thank you
Re: Update [message #37722 is a reply to message #37721] Mon, 25 February 2002 00:38 Go to previous messageGo to next message
Manoj
Messages: 101
Registered: August 2000
Senior Member
HI dear,
simply Use a sql%notfound cursor .
Re: Update [message #37724 is a reply to message #37721] Mon, 25 February 2002 04:49 Go to previous messageGo to next message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
manoj is correct. oracle opens implicit cursor for all dml statements. you can find status of implicit cursors using cursor attributes, just like explicit cursor attributes.

instead of cursor name , use SQL%

ex:

sql%notfound
sql%rowcount

SQL%rowcount gives number of rows affected by recent sql statement.
Re: Update [message #37726 is a reply to message #37721] Mon, 25 February 2002 07:33 Go to previous message
Tamim
Messages: 23
Registered: October 2001
Junior Member
To be more precise use the following

UPDATE table1
SET col1 = val1
WHERE condition;

IF SQL%NOTFOUND THEN
Blah.... --Write statements that should be executed if the update does not find any rows to update.
ELSE
Blah...
END IF;

Regards
Tamim
Previous Topic: Compilation Error
Next Topic: EXCEPTIONS AND LOOPS??
Goto Forum:
  


Current Time: Thu Mar 28 11:37:00 CDT 2024