MySQL存储过程仅在首次运行时返回结果

问题描述 投票:0回答:1

Picture of Problem

我的存储过程将在第一次调用时(无论是通过api还是MySQL Workbench)成功运行,但在返回第一行(第0行)之后的第二次或第n次成功运行。

什么导致这种行为?

json_table?

这里是步骤:

CREATE DEFINER=`root`@`localhost` PROCEDURE `graphs_characters_rank_bar`()
BEGIN
select
    x.*
from
    players p
    ,json_table(p.character_ranks, "$[*]" columns(
        rowid for ordinality
        ,`character` varchar(255) path "$.character" default '0' on error default '0' on empty
        ,`rank` int(11) path "$.rank" default '0' on error default '0' on empty
        )
    ) x
where
    p.id = 1
order by
    x.`rank` desc;
END

玩家表看起来像这样

|id|name|character_ranks|

|1|MyName|[{"rank": 930, "character": 12}]|

mysql stored-procedures mysql-workbench
1个回答
0
投票

[使用const

© www.soinside.com 2019 - 2024. All rights reserved.