MySQL Forums
Forum List  »  Stored Procedures

update problem
Posted by: Srivats Chandrasekaran
Date: November 22, 2005 06:57AM

1. If i want to do

if exists( select .... where ... ) then
update...
else
insert...

or

update...
if ( row_count() < 1) then
insert..

which causes lesser overhead, since in the first thing i am executing one extra query while checking.
There may be some cases where the where clause of the update satisfies but the values i am inserting will be the same in that case row_count() = 0 instead of 1. In this case the latter method will fail. Is there neway i can get the rows matched by the where clause of update statement.

Options: ReplyQuote


Subject
Views
Written By
Posted
update problem
2161
November 22, 2005 06:57AM
1418
November 22, 2005 06:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.