Using stored procedures
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
精彩评论