I am getting error message 'Operand should contain 1 column(s)' when executes a stored procedure in MySQL.
Following is the stored procedure:
DELIMITER $$
USE `test`$$
DROP PROCEDURE IF EXISTS `test_proc`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `test_proc`(IN inputMsisdn BIGINT)
BEGIN
IF(CHAR_LENGTH(inputMsisdn)=12, SUBSTR(3,inputMsisdn), inputMsisdn)
THEN
SELECT rmnum FROM testbase WHERE msisdn=inputMsisdn;
END IF;
END$$
DELIMITER ;
Can you please tell me whats the problem within this procedure?
The condition in an IF must be a single scalar, but you have commas so it's trying to treat it as a list of values. Perhaps you meant to use
AND
where you have commas?