开发者

Using stored procedures

开发者 https://www.devze.com 2023-04-13 01:09 出处:网络
Supposing i have a stored procedure fun(input, @val), and i want to call i开发者_Python百科t repeatedly, in a select. I tried like this:

Supposing i have a stored procedure fun(input, @val), and i want to call i开发者_Python百科t repeatedly, in a select. I tried like this:

select name, @val
from table
where {condition}
group by name

I need that @val be updated somewhere in the statement with:

 call fun(name, @val)

As the value of @val depends on the current "iteration".

How do i do?


Use a function that returns a value rather than using a stored procedure. Link to function creation syntax - http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

0

精彩评论

暂无评论...
验证码 换一张
取 消