What is wrong with mysql query?

Posted by bala3569 on Stack Overflow See other posts from Stack Overflow or by bala3569
Published on 2010-04-12T06:38:17Z Indexed on 2010/04/12 6:43 UTC
Read the original article Hit count: 401

Filed under:
|
|

I use the following mysql query,

DELIMITER $$
DROP PROCEDURE IF EXISTS `allied`.`aboutus_delete`$$
CREATE DEFINER=`allied`@`%` PROCEDURE `aboutus_delete`(
IN p_Id int(11)
)
BEGIN
if exists(select aboutUsId from aboutus where aboutUsId=p_id and isDeleted=0)
   update aboutus set isDeleted=1 where aboutUsId=p_id
else
   select 'No record to delete'
END$$
DELIMITER ;

But i get this error when i execute it...

Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
'update aboutus set isDeleted=1 where aboutUsId=p_id
else
   select 'No record to' at line 6

© Stack Overflow or respective owner

Related posts about mysql

Related posts about query