gpt4 book ai didi

mysql - 如何在sqlfiddle调用存储过程?

转载 作者:行者123 更新时间:2023-11-29 02:09:28 25 4
gpt4 key购买 nike

我将以下内容放入 sqlfiddle 的架构面板中:

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

在查询面板中。当我尝试运行查询时,收到错误消息:

DDL and DML statements are not allowed in the query panel for MySQL; only SELECT statements are allowed. Put DDL and DML in the schema panel.

如果我不能在查询面板?

http://www.sqlfiddle.com/#!9/b03ede/4

最佳答案

这是一个 SQLFiddle 错误。来自 https://github.com/zzzprojects/sqlfiddle3/issues/5 :

Unfortunately, I don't think this statement currently work in this version.

The good news is that we are currently working on a new version. The new version should allow this without a problem but unfortunately, we need more time before releasing it.

这似乎适用于早期版本:Execute triggers stored procedures on SqlFiddle. Mysql .

关于mysql - 如何在sqlfiddle调用存储过程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56844585/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com