日期:2014-05-16 浏览次数:20954 次
DROP PROCEDURE IF EXISTS `sptest`; CREATE PROCEDURE `sptest`() BEGIN DECLARE @id int(11)NOT NULL; SELECT @id INTO ContractID FROM contractinfo WHERE SymbolNum='al1105'; SELECT * FROM contractinfo WHERE ContractID=@id; END;
CREATE PROCEDURE `sptest`() BEGIN DECLARE id1 int(11); --not null不能定义 SELECT ContractID into id1 FROM contractinfo WHERE SymbolNum='al1105'; SELECT * FROM contractinfo WHERE ContractID=id1; END;
------解决方案--------------------
CREATE PROCEDURE `sptest`()
BEGIN
DECLARE id1 int(11)NOT NULL;
SELECT ContractID into id1 FROM contractinfo WHERE SymbolNum='al1105';
SELECT * FROM contractinfo WHERE ContractID=id1;
END;