• <i id='fvLDf'><tr id='fvLDf'><dt id='fvLDf'><q id='fvLDf'><span id='fvLDf'><b id='fvLDf'><form id='fvLDf'><ins id='fvLDf'></ins><ul id='fvLDf'></ul><sub id='fvLDf'></sub></form><legend id='fvLDf'></legend><bdo id='fvLDf'><pre id='fvLDf'><center id='fvLDf'></center></pre></bdo></b><th id='fvLDf'></th></span></q></dt></tr></i><div id='fvLDf'><tfoot id='fvLDf'></tfoot><dl id='fvLDf'><fieldset id='fvLDf'></fieldset></dl></div>

    <small id='fvLDf'></small><noframes id='fvLDf'>

    <legend id='fvLDf'><style id='fvLDf'><dir id='fvLDf'><q id='fvLDf'></q></dir></style></legend>
    <tfoot id='fvLDf'></tfoot>

    • <bdo id='fvLDf'></bdo><ul id='fvLDf'></ul>

        Mysql 语法错误创建存储过程

        时间:2023-10-25

      1. <i id='uqZoL'><tr id='uqZoL'><dt id='uqZoL'><q id='uqZoL'><span id='uqZoL'><b id='uqZoL'><form id='uqZoL'><ins id='uqZoL'></ins><ul id='uqZoL'></ul><sub id='uqZoL'></sub></form><legend id='uqZoL'></legend><bdo id='uqZoL'><pre id='uqZoL'><center id='uqZoL'></center></pre></bdo></b><th id='uqZoL'></th></span></q></dt></tr></i><div id='uqZoL'><tfoot id='uqZoL'></tfoot><dl id='uqZoL'><fieldset id='uqZoL'></fieldset></dl></div>

        <small id='uqZoL'></small><noframes id='uqZoL'>

        <tfoot id='uqZoL'></tfoot><legend id='uqZoL'><style id='uqZoL'><dir id='uqZoL'><q id='uqZoL'></q></dir></style></legend>
              <tbody id='uqZoL'></tbody>

                • <bdo id='uqZoL'></bdo><ul id='uqZoL'></ul>
                  本文介绍了Mysql 语法错误创建存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这让我发疯.

                   CREATE DEFINER=`root`@`localhost` PROCEDURE `CalcularCRTarea` (Id_Tarea INT, OUT crTarea decimal(12, 4))
                      DETERMINISTIC
                  BEGIN
                    DECLARE done BOOLEAN DEFAULT FALSE;
                    DECLARE _id BIGINT UNSIGNED;
                    DECLARE cur CURSOR FOR SELECT Id FROM Tarea_Frente where Id_Item_Tarea = Id_Tarea;
                    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done := TRUE;
                    OPEN cur;
                    testLoop: LOOP
                      FETCH cur INTO _id;
                      IF done THEN
                        LEAVE testLoop;
                      ELSE 
                          CALL CalcularCRFrente(_id, @suma);
                          SET crTarea = crTarea + @suma;
                      END IF;
                    END LOOP testLoop;
                  
                    CLOSE cur;      
                  END;
                  

                  phpmyadmin 返回我

                  MySQL said: Documentation
                  
                  #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4 
                  

                  那就是这条线

                    DECLARE done BOOLEAN DEFAULT FALSE;
                  

                  这里有什么问题?我尝试了几个小的更改,但总是遇到相同的错误.我检查了文档,但没有看到语法错误是什么.我知道这是一个愚蠢的错误,但我坚持了半个小时.是一个游标,它遍历每一行并为每一行执行一个存储过程;我已经使用存储函数完成了它(并且它像魅力一样工作)但是在服务器中发布时我看到我的共享主机不支持存储函数,只支持存储过程:(所以这是我最好的方式找到了.

                  what's wrong here ? I tried with several minor changes and I'm getting always the same error. I checked the documentation and I'm not seeing what's the syntax error. I know this is a silly error but I'm stucked with this like a half an hour. Is a cursor that iterates each row and executes a stored procedure for each one; I've done it with stored functions (and it worked like a charm) but at the time to publish in the server I saw that my shared hosting doesn't suppor stored functions, only stored procedures :( So it's the best way I've found.

                  推荐答案

                  您缺少自定义 delimiter 指令.

                  You are missing custom delimiter instruction.

                  正如你所忽略的,引擎在找到第一个默认语句终止符时尝试编译语句,分号 ;.因此例外.

                  As you missed it, engine tried to compile the statements when it found the first default statement terminator, the semicolon ;. And hence the exception.

                  将您的整个例程置于两者之间:

                  Place your entire routine in between:

                  -- define the delimiter
                  delimiter //
                  
                  
                  --- place here your stored procedure
                  
                  -- and lastly following line
                  //
                  
                  -- reset the delimiter
                  delimiter ;
                  

                  这篇关于Mysql 语法错误创建存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:带有序列和触发器的 oracle 自动增量无法正常工作 下一篇:查看 MySQL 中的存储过程/函数定义

                  相关文章

                      <bdo id='NrS54'></bdo><ul id='NrS54'></ul>
                    1. <i id='NrS54'><tr id='NrS54'><dt id='NrS54'><q id='NrS54'><span id='NrS54'><b id='NrS54'><form id='NrS54'><ins id='NrS54'></ins><ul id='NrS54'></ul><sub id='NrS54'></sub></form><legend id='NrS54'></legend><bdo id='NrS54'><pre id='NrS54'><center id='NrS54'></center></pre></bdo></b><th id='NrS54'></th></span></q></dt></tr></i><div id='NrS54'><tfoot id='NrS54'></tfoot><dl id='NrS54'><fieldset id='NrS54'></fieldset></dl></div>
                    2. <small id='NrS54'></small><noframes id='NrS54'>

                      <tfoot id='NrS54'></tfoot>
                      <legend id='NrS54'><style id='NrS54'><dir id='NrS54'><q id='NrS54'></q></dir></style></legend>