我将以下内容放入sqlfiddle的Schema面板中:
CREATE TABLE tb_patient (
`idPatient` INTEGER,
`prenomPatient` VARCHAR(12),
`nomPatient` VARCHAR(6)
)//
INSERT INTO tb_patient
(`idPatient`, `prenomPatient`, `nomPatient`)
VALUES
('267', 'Marie Claude', 'CARRIE'),
('268', 'Marie Claude', 'CARRIE')//
create procedure findTwins()
begin
declare getNom varchar(40);
declare getPrenom varchar(40);
declare getId int default 1;
declare getId2 int default 1;
if(select count(*) from tb_patient group by nomPatient,prenomPatient having count(*)=2 limit 1)
then
select nomPatient,prenomPatient into getNom,getPrenom from tb_patient group by nomPatient,prenomPatient having count(*)=2 limit 1;
set getId=(select min(idPatient) from tb_patient where nomPatient=getNom and prenomPatient=getPrenom);
set getId2=(select max(idPatient) from tb_patient where nomPatient=getNom and prenomPatient=getPrenom);
select concat(getNom,' ',getPrenom,' ',getId,' ',getId2) as Patient;
end if;
end//我从分隔符菜单中选择了//,并成功地构建了模式。
然后我说:
CALL FindTwins在查询面板中。当我试图运行查询时,我得到了错误消息:
MySQL的查询面板中不允许DDL和DML语句;只允许SELECT语句。将DDL和DML放在模式面板中。
如果我不能在查询面板中打电话,该如何查看该过程的结果?
http://www.sqlfiddle.com/#!9/b03ede/4
发布于 2019-07-02 03:58:51
这是一个SQLFiddle错误。来自https://github.com/zzzprojects/sqlfiddle3/issues/5
不幸的是,我不认为这个声明目前在这个版本中有效。 好消息是,我们目前正在开发一个新版本。新版本应该允许这样做,没有问题,但不幸的是,我们需要更多的时间才能发布它。
这似乎适用于早期版本:Execute triggers stored procedures on SqlFiddle. Mysql。
https://stackoverflow.com/questions/56844585
复制相似问题