命令不同步;现在不能在存储过程中运行此命令

aamkag61  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(499)

我有以下几点 stored proceduremysql :

DELIMITER $$
CREATE DEFINER=`user`@`localhost` PROCEDURE `insert_patient`(IN `name` VARCHAR(45), IN `surname` VARCHAR(45), IN `middle_name` VARCHAR(45), IN `patient_gender` VARCHAR(15), IN `patient_weight` VARCHAR(15), IN `patient_height` VARCHAR(15), IN `patient_ethnic_origin` VARCHAR(45))
    NO SQL
BEGIN

BEGIN
INSERT
INTO
  patient(
    name,
    surname,
    middle_name
  )
VALUES(
  name,
  surname,
  middle_name
) ;
SELECT
  LAST_INSERT_ID() AS patient_local_id;
END;
BEGIN
INSERT
INTO
  demographics(
    patient_id,
    gender,
    weight,
    height,
    ethnic_origin
  )
VALUES(
  patient_local_id,
  patient_gender,
  patient_weight,
  patient_height,
  patient_ethnic_origin
) ;
END;
END$$
DELIMITER ;

当我试图从 phpmyadmin 我得到以下错误:

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
iqxoj9l9

iqxoj9l91#

我找到了解决办法。在执行存储过程时,我选中了下面的框。

相关问题