【问题标题】:How to call stored procedure at sqlfiddle?如何在 sqlfiddle 调用存储过程?
【发布时间】:2019-07-02 02:33:02
【问题描述】:

我将以下内容放入 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

【问题讨论】:

    标签: mysql sql stored-procedures sqlfiddle


    【解决方案1】:

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

    不幸的是,我认为这个说法目前在这方面行不通 版本。

    好消息是我们目前正在开发一个新版本。这 新版本应该可以毫无问题地做到这一点,但不幸的是,我们 在发布之前需要更多时间。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-03
      相关资源
      最近更新 更多