0

I am creating procedure which selects member_id in courser.member_id having more that 100000 records. i had declared one variable i which stores one member id at time update it with next query.

can anyone resolve this..? procedure is as follows:-

    DELIMITER //
DROP PROCEDURE IF EXISTS Mock_test_1;
CREATE PROCEDURE Mock_test_1()
   BEGIN
DECLARE i int unsigned;
DECLARE curs1 CURSOR FOR select member_id from client_master;
open curs1;
read_loop: LOOP
      FETCH curs1 INTO i;
update client_master set
         `mobileno`='0000001231', 
         `email`=concat('MOCK',member_id,'@mock.com'), `password`=md5('MOCK'),
         `personaladdress` = concat('MOCK',member_id),
         businessaddress = concat('MOCK',member_id),
         imeino = '00000000000000', panno= 'AAAAA66666' ,aadharno = '11111111111111';
insert into client_master_test select * from client_master;
   END //
 DELIMITER ;

can anyone suggest me blocker for this..?

2
  • What is the error message? Commented Aug 18, 2016 at 11:23
  • in your query you do not have any where clause. can you please explain the purpose of the procedure.
    – Chandan
    Commented Aug 18, 2016 at 13:58

1 Answer 1

0
  • You are fetching into i, but not using it.
  • There is no end loop.
  • The insert is copying the whole table over repeatedly?

Consider using a single multi-table UPDATE, not a Stored Procedure with a loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.