今天在写存储过程时,出现了 [Err] 1241 - Operand should contain 1 column(s) 。
存储过程写法如下:
create PROCEDURE `de3`()
BEGIN
#Routine body goes here...
SET @record = (select * from user where name="小明");
SET @x='hello World';
SELECT @x;
END
问题在于 : 返回的列过多 注意 " * " ,改成需要的列名就可以了,这里将select 后的 * 改为 name
mysql 自定义变量的赋值为单记录赋值。一点一点进步!