首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何调用sqlfiddle的存储过程?

如何调用sqlfiddle的存储过程?
EN

Stack Overflow用户
提问于 2019-07-02 02:33:02
回答 1查看 414关注 0票数 2

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

代码语言:javascript
复制
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//

我从分隔符菜单中选择了//,并成功地构建了模式。

然后我说:

代码语言:javascript
复制
CALL FindTwins

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

MySQL的查询面板中不允许DDL和DML语句;只允许SELECT语句。将DDL和DML放在模式面板中。

如果我不能在查询面板中打电话,该如何查看该过程的结果?

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

EN

回答 1

Stack Overflow用户

发布于 2019-07-02 03:58:51

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

不幸的是,我不认为这个声明目前在这个版本中有效。 好消息是,我们目前正在开发一个新版本。新版本应该允许这样做,没有问题,但不幸的是,我们需要更多的时间才能发布它。

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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56844585

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档