0

I´m creating a simple procedure to delete a row from the table tbGame, but when I try to call the proc it returns the error 1093

I have tried to figure out what's happening by deleting the row using the normal command(DELETE FROM <table>) but it didn´t work. After researching a bit I found that this error usually happens when there is a SELECT in the subquery, but the procedure has none, I also tried to turn off the derived_merge but it didn´t work too,in the end I created another database and tried the same procedure and it worked, so I think the problem is not in my procedure.


---turning off derived_merge

SET @@optimizer_switch='derived_merge=OFF';

-- that´s the procedure
DELIMITER //

CREATE PROCEDURE sp_DeleteGame (in _idGame int)

begin
    delete from tbGame where idGame = _idGame;
end // 

DELIMITER ;


-- that´s the normal delete command that I used

DELETE FROM tbGame WHERE idGame = 1;


In both cases Mysql returns:

'Error Code: 1093. You can't specify target table 'tbGame' for update in FROM clause'

0 Answers0