cmh Posted June 22, 2018 Posted June 22, 2018 (edited) Hello. For the first time I try to understand this topic, but there are questions.I create a test procedure DELIMITER // DROP procedure IF EXISTS UserExist // CREATE procedure UserExist (IN UserName VARCHAR(50), out RetMsg int) BEGIN SELECT id INTO RetMsg FROM Tab WHERE user = UserName; END; // DELIMITER ; DELIMITER // DROP procedure IF EXISTS SomeAuth // CREATE PROCEDURE SomeAuth (UserName VarCHAR(50)) BEGIN DECLARE pid int DEFAULT 0; DECLARE pMSG int DEFAULT 0; DECLARE pFile Mediumblob; DECLARE IsUser VARCHAR(20); set IsUser ='DefVal'; call UserExist(UserName, @pMSG); if pMSG = 0 then set pid = 0; else set pid = 1; end iF; select @pid, @pMSG ; END // DELIMITER ; call SomeAuth('xxxxxxxxxxxxxxxxx'); In return i have:@pid @pMSG<null> 20and so, I do not understand whypid =<nul>?why not 0 (as default value) or 1 (as if statement). Edited June 22, 2018 by cmh Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.