Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 我在MariaDB事件计划程序中出错_Sql_Event Handling_Mariadb - Fatal编程技术网

Sql 我在MariaDB事件计划程序中出错

Sql 我在MariaDB事件计划程序中出错,sql,event-handling,mariadb,Sql,Event Handling,Mariadb,我很想创建一个这样的事件来管理队列,但是代码是错误的。我不知道这是为什么。我一直在网站上搜索,但还没有找到最好的解决方案。我该怎么办?有人可以解释吗?如果所有最新的桌子尺寸ID都有电话号码怎么办?事件无法通过它找到有用的东西 Table\u Size\u ID——您正在标准化大小吗?(我希望不是。) 请提供SHOW CREATE TABLE delimiter | CREATE EVENT queue_sorting ON SCHEDULE EVERY 1 SECONDS DO

我很想创建一个这样的事件来管理队列,但是代码是错误的。我不知道这是为什么。我一直在网站上搜索,但还没有找到最好的解决方案。我该怎么办?有人可以解释吗?

如果所有最新的桌子尺寸ID都有电话号码怎么办?事件无法通过它找到有用的东西

Table\u Size\u ID
——您正在标准化大小吗?(我希望不是。)

请提供
SHOW CREATE TABLE

delimiter |

CREATE EVENT queue_sorting
    ON SCHEDULE EVERY 1 SECONDS
    DO
    BEGIN
        DECLARE ts, pn INT;

select  Table_Size_ID INTO ts
    from  Tables
    where  Table_Size_ID = 
      ( SELECT  Table_Size_ID
            from  Queue
            order by  Q_TIME desc
            limit  1
      )
      and  Phone_Number is null
    order by  Table_Line asc, Table_Number asc
    limit  1;


select Phone_Number into pn from Queue order by Q_TIME desc limit 1;

update tables set Phone_Number=pn where Table_Size_ID=ts;


delete from Queue where Phone_Number=pn and Table_Size_ID=ts;

END |

delimiter ;