存储过程中OUT参数出错

时间:2012-11-29 14:10:09

标签: mysql sql stored-procedures

执行我的SP时出现以下错误:

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 '; select @nodata_issue,@dateof_issue' 
at line 1

SQL Error (1414): OUT or INOUT argument 2 for routine proc1 is 
not a variable or NEW pseudo-variable in BEFORE trigger

这些参数声明如下:

PROCEDURE proc1(IN `idpap` INT, OUT `nodata_issue` TINYINT, OUT `dateof_issue` DATE)

*编辑:已更改并启动问题的代码块:

PROCEDURE proc1(IN `idpapel` INT, OUT `nodata_issue` TINYINT, OUT `dateof_issue` DATE)
  DETERMINISTIC
BEGIN
DECLARE primeira_mov, data_anterior DATE;
select data into primeira_mov from excel.trade_mov where papel = idpapel order by data LIMIT 1;

BLOCK1: begin

DECLARE ...
DECLARE cur1 CURSOR FOR select data, valor_split, valor_div from excel.trade_correcao where data >= primeira_mov and id_papel = idpapel order by data DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
DECLARE CONTINUE HANDLER FOR 1329 BEGIN
        SET nodata_issue = 1;
        SET dateof_issue = datasplit;
    END;

set data_anterior = "2200-01-01";
set valor_aplicavel = 1;
set preco_fator = 1;
SET nodata_issue = 0;
SET dateof_issue = null;

CALL create_temp_tables();
TRUNCATE TABLE tbl1;


-- START TRANSACTION;

OPEN cur1;

read_loop_1: LOOP

有关导致此错误的原因的任何想法?

0 个答案:

没有答案