nice explanation, ronan
unfortunately your example is not the best
instead of this --
Quote:
Originally Posted by it-iss.com
SELECT count(*) INTO count FROM emp WHERE name = 'test';
IF count = 0 THEN
INSERT INTO ...
ELSE
UPDATE emp ...
END IF
|
you can use a single INSERT... ON DUPLICATE KEY UPDATE statement
otherwise, your advice regarding avoiding multiple calls to the database is correct
