0
I would like to make a procedure which updates birth date, basing on personal identity number and everything works well apart from one thing. PID is taken only once and consequently the result is the same for all 200 records. How should I change this? For example: PID of the first value is 30052766293, so birth_date = 1930-05-27,but for left PIDs result (date) is the same CREATE PROCEDURE proc() BEGIN DECLARE s INT DEFAULT 0; abc:LOOP UPDATE people SET birth_date = (SELECT str_to_date(CONCAT('19',substring(PID,1,2), substring(PID,3,2), substring(PID,5,2) ) , '%Y %m %d') FROM workers LIMIT 1); SET s = s+1; IF s>=200 THEN LEAVE abc; END IF ; ...