如何在sqlfiddle中调用存储过程? [英] How to call stored procedure at sqlfiddle?

查看:224
本文介绍了如何在sqlfiddle中调用存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sqlfiddle的模式"面板中添加了以下内容:

I put the following into the Schema panel at 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//

我从定界符菜单中选择了//,并成功构建了架构.

I selected // from the delimiter menu, and successfully built the schema.

然后我输入:

CALL FindTwins

在查询面板中

.当我尝试运行查询时,收到错误消息:

in the query panel. When I tried to run the query, I got the error message:

MySQL的查询面板中不允许使用

DDL和DML语句.仅允许使用SELECT语句.将DDL和DML放在架构面板中.

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.

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

How am I supposed to see the result of the procedure if I can't put a call in the query panel?

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

推荐答案

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

This is a SQLFiddle bug. From 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在SqlFiddle上触发存储过程. mysql .

This seems to work in earlier versions: Execute triggers stored procedures on SqlFiddle. Mysql.

这篇关于如何在sqlfiddle中调用存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆