I'm trying to create a procedure with a loop inside, but when i call it just show the first record and dont interate.
delimiter //
create procedure load_foo_test_data()
begin
declare v_max int unsigned default 10;
declare v_counter int unsigned default 1;
select COUNT(*) into v_max FROM emp;
start transaction;
while v_counter < v_max do
select * from emp where emp_id = v_counter;
set v_counter=v_counter+1;
end while;
commit;
end
//
delimiter ;
when i call the procedure, it shows me just the first record (with ID 1).
I tried with "select v_counter" and only shows 1 too.
and tried with loop instead while and same thing.
i'm working with sequel pro in mysql 5.5
Thanks!