MySQL stored procedure select returning incorrect values -


i noticed select statement inside stored procedure returning same value, no matter parameter i'm calling stored procedure with. here's code:

delimiter $$ create procedure test(in id int) begin   declare x int default 0;   select id;     select paper_id     x     paper     id = id     limit 1;     select x; end$$ 

x returns same value no matter id call test with. noticed value of x value of paper_id in first row of paper table.

however, if run same query outside of stored procedure, expected value.

what going wrong inside stored procedure skews value?

i'm not familiar mysql's stored procedures, expression where id = id evaluated "all rows paper value in column id equals value in column id" , ignores parameter?

try rename parameter different column name in query.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -