I have a stored procedure in mysql 5.1.48 that deletes old data from my tables. I would like to keep a running count while it does this. Here is what I try now: ... DECLARE dropCnt INT DEFAULT 0; ... SET @sql = CONCAT('DELETE FROM myTable WHERE itemid = ', iID, ' AND clock BETWEEN 0 AND ', histUnixTime, ' '); PREPARE s1 FROM @sql; EXECUTE s1; SELECT ROW_COUNT() INTO dropCnt; DEALLOCATE PREPARE s1; ...
The problem here is that "SELECT ROW_COUNT() INTO dropCnt;" returns NULL every time. If I just do the select without the INTO, I get 0 or some actual count of rows. How can I get my dropCnt variable correcly set? Thanks, Bryancan