作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建以下过程:
CREATE PROCEDURE `client_clinical_visit`()
DETERMINISTIC
COMMENT 'Client clinical visit '
BEGIN
SELECT
`db565263480`.`kp_bio_data`.`uuid` AS `uuid`,
`db565263480`.`kp_bio_data`.`firstname` AS `firstname`,
`db565263480`.`kp_bio_data`.`lastname` AS `lastname`,
`db565263480`.`kp_bio_data`.`id` AS `kp_bio_data_id`,
`db565263480`.`kp_bio_data`.`tel` AS `tel`,
`db565263480`.`kp_bio_data`.`gender` AS `gender`,
`db565263480`.`kp_bio_data`.`marital_status` AS `marital_status`,
`db565263480`.`kp_bio_data`.`education_level` AS `education_level`,
`db565263480`.`kp_bio_data`.`place_of_birth` AS `place_of_birth`,
`db565263480`.`kp_types`.`id` AS `kp_types_id`,
`db565263480`.`kp_types`.`Name` AS `name`,
`db565263480`.`kp_types`.`Abbrv` AS `abbrv`,
`db565263480`.`clinic_visit`.`disc_no` AS `disc_no`
FROM
((`kp_bio_data`
INNER JOIN `kp_types` ON ((`db565263480`.`kp_bio_data`.`kp_id` = `db565263480`.`kp_types`.`id`)))
INNER JOIN `clinic_visit` ON ((`db565263480`.`clinic_visit`.`uuid` = `db565263480`.`kp_bio_data`.`uuid`)));
END
但我不断收到以下错误:
MySQL said: Documentation
#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 '' at line 22
请告知如何解决这个问题...
最佳答案
您可能错过了分隔符,并且在选择查询中不需要大括号,因此只需删除它们即可,
delimiter //
CREATE PROCEDURE `client_clinical_visit`()
DETERMINISTIC
COMMENT 'Client clinical visit '
BEGIN
SELECT
`db565263480`.`kp_bio_data`.`uuid` AS `uuid`,
`db565263480`.`kp_bio_data`.`firstname` AS `firstname`,
`db565263480`.`kp_bio_data`.`lastname` AS `lastname`,
`db565263480`.`kp_bio_data`.`id` AS `kp_bio_data_id`,
`db565263480`.`kp_bio_data`.`tel` AS `tel`,
`db565263480`.`kp_bio_data`.`gender` AS `gender`,
`db565263480`.`kp_bio_data`.`marital_status` AS `marital_status`,
`db565263480`.`kp_bio_data`.`education_level` AS `education_level`,
`db565263480`.`kp_bio_data`.`place_of_birth` AS `place_of_birth`,
`db565263480`.`kp_types`.`id` AS `kp_types_id`,
`db565263480`.`kp_types`.`Name` AS `name`,
`db565263480`.`kp_types`.`Abbrv` AS `abbrv`,
`db565263480`.`clinic_visit`.`disc_no` AS `disc_no`
FROM
`kp_bio_data`
INNER JOIN `kp_types` ON `db565263480`.`kp_bio_data`.`kp_id` = `db565263480`.`kp_types`.`id`
INNER JOIN `clinic_visit` ON `db565263480`.`clinic_visit`.`uuid` = `db565263480`.`kp_bio_data`.`uuid`;
END;//
delimiter ;
这是mysql中的测试用例
mysql> delimiter //
mysql>
mysql> CREATE PROCEDURE `client_clinical_visit`()
-> DETERMINISTIC
-> COMMENT 'Client clinical visit '
-> BEGIN
-> SELECT
-> `db565263480`.`kp_bio_data`.`uuid` AS `uuid`,
-> `db565263480`.`kp_bio_data`.`firstname` AS `firstname`,
-> `db565263480`.`kp_bio_data`.`lastname` AS `lastname`,
-> `db565263480`.`kp_bio_data`.`id` AS `kp_bio_data_id`,
-> `db565263480`.`kp_bio_data`.`tel` AS `tel`,
-> `db565263480`.`kp_bio_data`.`gender` AS `gender`,
-> `db565263480`.`kp_bio_data`.`marital_status` AS `marital_status`,
-> `db565263480`.`kp_bio_data`.`education_level` AS `education_level`,
-> `db565263480`.`kp_bio_data`.`place_of_birth` AS `place_of_birth`,
-> `db565263480`.`kp_types`.`id` AS `kp_types_id`,
-> `db565263480`.`kp_types`.`Name` AS `name`,
-> `db565263480`.`kp_types`.`Abbrv` AS `abbrv`,
-> `db565263480`.`clinic_visit`.`disc_no` AS `disc_no`
-> FROM
-> `kp_bio_data`
-> INNER JOIN `kp_types` ON `db565263480`.`kp_bio_data`.`kp_id` = `db565263480`.`kp_types`.`id`
-> INNER JOIN `clinic_visit` ON `db565263480`.`clinic_visit`.`uuid` = `db565263480`.`kp_bio_data`.`uuid`;
-> END;//
Query OK, 0 rows affected (0.08 sec)
关于MySQL 说 : Documentation #1064 - You have an error in your SQL syntax; on Stored Procedure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29539393/
我是一名优秀的程序员,十分优秀!