MySQL Forums
Forum List  »  Stored Procedures

Looping
Posted by: Vincent Oh
Date: August 03, 2012 02:25AM

Hi, I'm new do stored procedures so I will need some help with this.

Let's say i got a table (Employee) with 4 important fields (id, firstname, lastname, age, etc,...., etc, etc).

Now i need to retrieve these 4 fields and for each row, i will need to execute an update statement so that i can update another table (Salary) based on the 4 values from Employee.

How do i write the procedure to have such a loop that i can first do a SELECT statement from Employee, then loop through the results to do the UPDATE?

Thanks alot.

Options: ReplyQuote


Subject
Views
Written By
Posted
Looping
2020
August 03, 2012 02:25AM
1035
August 03, 2012 07:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.