Can I lock tables in an IF statement in MySQL?
Posted
by MalcomTucker
on Stack Overflow
See other posts from Stack Overflow
or by MalcomTucker
Published on 2010-03-13T18:52:47Z
Indexed on
2010/03/13
18:55 UTC
Read the original article
Hit count: 190
mysql
This is throwing a syntax error -
--from body of a stored proc
IF (name = in_name)
SET out_id = temp;
ELSE
LOCK TABLE People WRITE;
INSERT INTO People (Name)
VALUES (in_name);
UNLOCK TABLE;
SELECT LAST_INSERT_ID() INTO out_id
END IF
do I have to lock any tables I need at the start of the SP?
© Stack Overflow or respective owner