I want to update inserted row field name is "hash_code" with MD5().
DELIMITER
//
CREATE TRIGGER `make_hash2` AFTER INSERT ON
`newtable` FOR EACH ROW
BEGIN
DECLARE
_id INTEGER ;
SELECT
id
INTO _id
FROM
`newtable`
ORDER BY `id`
DESC
LIMIT 1;
UPDATE
`newtable`
SET
`hash_code` = MD5(_id)
WHERE
id = _id ;
END
I tried using the following code but throwing the following error on insert.
#1442 - Can't update table 'newtable' in stored function/trigger because it is already used by statement which invoked this stored function/trigger