>  기사  >  데이터 베이스  >  mysql- 错误代码: 1064 You have an error in your SQL syntax;

mysql- 错误代码: 1064 You have an error in your SQL syntax;

WBOY
WBOY원래의
2016-06-06 09:39:062943검색

mysqlcursorsql

求高手指点 语法哪里有问题啊

DELIMITER $$

CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE x_similarity.CovarianceEngine()
/*LANGUAGE SQL
| [NOT] DETERMINISTIC
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'*/
BEGIN
/* 定义变量一 /
DECLARE done, done2 INT DEFAULT 0;
DECLARE stockNo_a VARCHAR(6);
DECLARE coefficient DOUBLE(16,14);
/
定义光标 */

DECLARE _Cur CURSOR FOR

SELECT DISTINCT stock_no FROM history_day;

<code>DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;#错误定义,标记循环结束  /* 打开光标 */  OPEN _Cur;       /* 循环执行 */      REPEAT          FETCH _Cur INTO stockNo_a;          IF NOT done THEN              BEGIN                /* 定义变量一 */                  DECLARE stockNo_b VARCHAR(6);                /* 定义光标 */                 DECLARE _CurInner CURSOR FOR                      SELECT DISTINCT stock_no FROM history_day;                OPEN _CurInner;                    REPEAT                    FETCH _CurInner INTO stockNo_b;                      IF NOT done2 THEN                        SELECT                            (                                AVG(a. CLOSE * b. CLOSE) - AVG(a. CLOSE) * AVG(b. CLOSE)                            ) / SQRT(                                (                                    AVG(a. CLOSE * a. CLOSE) - AVG(a. CLOSE) * AVG(a. CLOSE)                                ) * (                                    AVG(b. CLOSE * b. CLOSE) - AVG(b. CLOSE) * AVG(b. CLOSE)                                )                            ) INTO coefficient                        FROM                            history_day a,                            history_day b                        WHERE                            a.date = b.date                        AND a.date >= '2015-08-05'                        AND a.date  0.5 OR coefficient </code>

DELIMITER ;

错误代码: 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 'END IF;
UNTIL done END REPEAT;
CLOSE _Cur;
END' at line 65

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.