MySQL Stored Procedure Variables - When to Use Which -
i new mysql. when use declared variable? when use undeclared variable (@vartest)
.
i wondering best practice. thank you.
you should create procedural variables declare
maintain proper scope. session variables declared outside function can changed inside function, , vice-versa.
drop procedure if exists foo; delimiter $ create procedure foo() begin declare foo int; set foo = 123; set @foo = 456; select foo, @foo; end$ delimiter ; set @foo = "bar"; call foo(); select @foo;
Comments
Post a Comment