mwskuzzy
asked on
While Loops In MySQL
I am am MS SQL developer and I am busy trying to migrate over to MySQL. I need to populate a table for testing and I would like to do this using a while loop. I noticed that MySQL does support the while conditional statement but for some reason it does not want to work. I noticed that is I wrap it in a stored procedure then it works fine????
Please tell me if I can run a while loop directly or are all conditional statements limited to stored procedures and functions?
Set @i = 0;
while @i < 1000000 do
Insert into payment_instructions (acc_no,acc_type,br_code,b r_name,ban k_name,ins tr_val,dt_ date)
Values ('4252123521','Current','6 32005','Wi tbank','AB SA',138.52 ,01);
Set @i = @i+1;
end while;
Please tell me if I can run a while loop directly or are all conditional statements limited to stored procedures and functions?
Set @i = 0;
while @i < 1000000 do
Insert into payment_instructions (acc_no,acc_type,br_code,b
Values ('4252123521','Current','6
Set @i = @i+1;
end while;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.