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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now