[英]Mysql Stored Procedure Select Column into OUT parameter
I have a stored procedure similar to this one, and when I try to save it, I get this error: 我有一个类似于这个的存储过程,当我尝试保存它时,我收到此错误:
Undeclared variable: my_column
未声明的变量:my_column
CREATE PROCEDURE p (OUT column_param VARCHAR(25))
BEGIN
SELECT my_column INTO coumn_param limit 1;
END;
Why can I not select a column to return? 为什么我不能选择要返回的列?
Here my actual query within the procedure: 这是我在程序中的实际查询:
select latitude into lat, longitude into lon
from cities cc
inner join countries c on cc.country_id = c.country_id
inner join regions r on cc.region_id = r.region_id and c.country_id = r.country_id
left join locations l on cc.city_id = l.city_id
where
city = coalesce(cty, city) and
country = coalesce(ctry, country) and
region = coalesce(reg, region)
limit 1;
Your syntax of INTO
clause is incorrect 您的
INTO
子句的语法不正确
Assuming that your query itself is correct and functional and you have lat
and lon
variables declared change this part 假设您的查询本身是正确且有效的,并且您声明了
lat
和lon
变量,则更改此部分
select latitude into lat, longitude into lon
to 至
SELECT latitude, longitude INTO lat, lon
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.