2

I have stored procedure in mysql. The procedure is created, but when the procedure is called I get an error:

"Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor -> Query Editor and reconnect."

Here is the procedure:

------------------------------------------------
drop procedure if exists update_per_det;

delimiter //

create procedure update_per_det(IN name varchar(30))

begin

 DECLARE age1 int;

set age1=(select CalAge(name));

update  per_det set age=age1 where username=name;

end;//

delimiter ;

How can I solve this issue?

1
  • please learn how to format quotes, code, etc. Read the FAQ for more information. Commented Mar 30, 2012 at 13:37

2 Answers 2

2

Try this:

set age1=(select CalAge(name));

SET SQL_SAFE_UPDATES=0;

update  per_det set age=age1 where username=name;
Sign up to request clarification or add additional context in comments.

Comments

0

Use DELIMITER like this:

DROP PROCEDURE IF EXISTS DealStateChange;

DELIMITER //

CREATE PROCEDURE DealStateChange(statusID tinyint)



     UPDATE deals
          SET `status` = statusID
      WHERE `id` = 1001;




//
DELIMITER ;


/* for execute PROCEDURE */
CALL DealStateChange(11);

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.