Update [message #37721] |
Mon, 25 February 2002 00:15 |
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 #37724 is a reply to message #37721] |
Mon, 25 February 2002 04:49 |
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 |
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
|
|
|