如何修复mysql运行时错误

时间:2017-02-22 06:53:18

标签: mysql

我正在使用mysql,在执行存储过程时它会给出运行时错误..  如果我只运行查询它正在执行。

   CREATE DEFINER=`root`@`localhost` PROCEDURE   
      `sp_get_Ad_Img_Details_dummy1`(IN `xp_postId` VARCHAR(5))
   BEGIN

    select * FROM post_ad_list post_ad_list_al 
    INNER JOIN product_images product_images_al ON 
    product_images_al.pi_postid = post_ad_list_al.p_postId WHERE   
    p_postId=xp_postId;
    END



      call sp_get_Ad_Img_Details_dummy1('20170219074922');

执行存储过程后,我得到了Erro ..

如何修复它......

   Error
   Static analysis:

   1 errors were found during analysis.

   Unrecognized keyword. (near "ON" at position 25)
   SQL query: Edit Edit

   SET FOREIGN_KEY_CHECKS = ON;

   MySQL said: Documentation

   #2014 - Commands out of sync; you can't run this command now

   Thanks

2 个答案:

答案 0 :(得分:0)

你写的product_images_al.pi_postidId可能是用大i写的,就像你用其他词所做的那样吗?

如果您想查看例外,请尝试:

BEGIN TRY
/* Coding ... */
END TRY

BEGIN CATCH
/* Catching code... */
END CATCH

希望这会有所帮助......

答案 1 :(得分:0)

确保使用以下方法设置外键检查

SET FOREIGN_KEY_CHECKS=1;

SET FOREIGN_KEY_CHECKS=0;