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?
IF(CHAR_LENGTH(inputMsisdn)=12, SUBSTR(3,inputMsisdn), inputMsisdn)
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?
I think the error is on this line
IF(CHAR_LENGTH(inputMsisdn)=12, SUBSTR(3,inputMsisdn), inputMsisdn)
but i couldnt tell you why :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.