以下是我的存储过程的DDL。
DROP PROCEDURE IF EXISTS bbt_admin.getNUM;
CREATE PROCEDURE bbt_admin.`getNUM`(IN vUei CHAR(52),
IN vNum VARCHAR(52),
OUT s VARCHAR(100),
OUT e VARCHAR(100))
BEGIN
SELECT
trim(concat(ns.PREFIX,ns.Num)) AS NUM,
ns.COUNTRY_CODE AS COUNTRY_CODE
INTO @s,
@e
FROM CUSTOMER cu
join SITE si ON si.PARENT_ID = cu.ID
join NUM_RANGES nr ON nr.SITE_ID = si.ID
join NUMBERS ns ON ns.RANGE_ID = nr.RANGE_ID
join ADDRESSES as saddr ON si.ID = saddr.UEI
join PROVISION_SETTING as ps ON ps.UEI = si.ID
WHERE (cu.ID = vUei OR si.ID = vUei)
AND ( ns.OWNER NOT LIKE 'sub%' OR ns.OWNER IS NULL )
AND ns.NUMBER_CLASS in (1,5,9)
AND trim(concat(ns.PREFIX,ns.Num))= vNum;
END;
当我执行mysql存储过程时,它成功执行但输出参数始终包含NULL值。请查找以下用于调用存储过程和选择OUT参数值的语句:
CALL getNUM('customer:11', '012124215421', @s, @e);
select @s, @e;
当我单独运行SELECT语句时,我得到OUT参数值,但是执行存储过程总是返回带有NULL值的OUT参数
SELECT
trim(concat(ns.PREFIX,ns.Num)) AS NUM,
ns.COUNTRY_CODE AS COUNTRY_CODE
INTO @s,
@e
FROM CUSTOMER cu
join SITE si ON si.PARENT_ID = cu.ID
join NUM_RANGES nr ON nr.SITE_ID = si.ID
join NUMBERS ns ON ns.RANGE_ID = nr.RANGE_ID
join ADDRESSES as saddr ON si.ID = saddr.UEI
join PROVISION_SETTING as ps ON ps.UEI = si.ID
WHERE (cu.ID = 'customer:11' OR si.ID = 'customer:11')
AND ( ns.OWNER NOT LIKE 'sub%' OR ns.OWNER IS NULL )
AND ns.NUMBER_CLASS in (1,5,9)
AND trim(concat(ns.PREFIX,ns.Num))= '012124215421';
你能帮我解决一下这个问题。提前致谢