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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -