I set up mysql stored procedure. I have problem with if-else statement . It seem if else not work. Everyone have any idea. I want to check if state is 0 update new state.
CREATE DEFINER=`homestead`@`%` PROCEDURE `insertLoginLog`()
BEGIN
DECLARE errno INT;
DECLARE state INT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
SELECT state INTO state FROM stored_procedure_state WHERE stored_procedure_state.name = 'insertLoginLog';
IF(state = 0) THEN
UPDATE stored_procedure_state SET state = 1 WHERE stored_procedure_state.name = 'insertLoginLog';
END IF;
END;
END
Aucun commentaire:
Enregistrer un commentaire