in my stored procedure i have some if else statements:
SET @status = "";
IF (code is invalid...
SET @status = "Invalid code.";
SELECT @status;
END IF;
IF (name is invalid..
SET @status = "Invalid name.";
SELECT @status
END IF;
IF (code and name already exists)
SET @status = "Record exists.";
SELECT @status
ELSE
SET @status = "Record added.";
SELECT @status
END IF;
SELECT @status;
The @status always return the value from the last IF .. ELSE statement.
Since RETURN can't be used in a procedure, what syntax should i use to
immediately exit the stored procedure if the first IF statement is true?