In MySQL stored procedures, don't put an @
symbol in front of local variables (input parameters or locally declared variables). The @id
you used refers to a user variable, which is kind of like a global variable for the session you're invoking the procedure from.
In other words, @id
is a different variable from id
.
That's the explanation of the immediate problem you're having. However, I would not design the tables as you have done.
Since not all the records have data in all columns, I thought this might be a more efficient way to load the data
I recommend using a conventional single table, and use NULL to signify missing data.