代码之家  ›  专栏  ›  技术社区  ›  Sitansu

SQLyog MySQL错误代码:1064-无法执行查询

  •  0
  • Sitansu  · 技术社区  · 6 年前

    我面临与MySQL错误代码1064相关的问题。无法在SQLyog中找到有关此问题的正确解决方案。有谁能帮我解决这个问题吗。

    MySQL error: 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

    DELIMITER $$
    
    DROP PROCEDURE IF EXISTS `migratedriving`$$
    
    CREATE  PROCEDURE `migratedriving`(
     IN pCode VARCHAR(50)
    )
    BEGIN
    
    
       INSERT INTO `employeedriving` (
        `employeeCode`,
        `license`,
        `licenseNo`,
        `licenseType`,
        `issueDate`,
        `expirationDate`,
        `licenseState`,
        `licenseImage1`,
        `licenseImage2`,
        `notifyexpiresemail`,
        `createdBy`,
        `createdDate`
      ) 
      SELECT 
        appdriving.applicantCode,
        appdriving.license,
        appdriving.licenseNo,
        appdriving.licenseType,
        appdriving.issueDate,
        appdriving.expirationDate,
        appdriving.licenseState,
        appdriving.licenseImage1,
        appdriving.licenseImage2,
        appdriving.notifyexpiresemail,
        appdriving.createdBy,
        NOW()
      FROM applicantdriving appdriving
       WHERE appdriving.applicantCode=pCode;
    
      DECLARE v_finished INTEGER  DEFAULT 0;
      DECLARE drivingID BIGINT(20);
    
    
     DECLARE drivingID_cursor CURSOR FOR 
     SELECT ID FROM applicantdriving  app WHERE app.applicantCode=pCode;
    
    
     DECLARE CONTINUE HANDLER 
    FOR NOT FOUND SET v_finished = 1;
    
     OPEN drivingID_cursor;
    
     get_ID: LOOP
    
     FETCH drivingID_cursor INTO drivingID;
    
     IF v_finished = 1 THEN 
     LEAVE get_ID;
     END IF;
    
    
     CALL migratedrivingticket(drivingID);
    
     END LOOP get_ID;
    
     CLOSE drivingID_cursor;
    
    
    END$$
    
    DELIMITER ;
    

    2 queries executed, 1 success, 1 errors, 1 warnings
    
    Query: DROP PROCEDURE IF EXISTS `migratedriving`
    
    0 row(s) affected, 1 warning(s)
    
    Execution Time : 0.004 sec
    Transfer Time  : 1.958 sec
    Total Time     : 1.963 sec
    
    Note: To see complete list of warning(s), enable Tools -> Preferences -> General -> Show Warning(s) in Messages Tab
    --------------------------------------------------
    
    Query: CREATE PROCEDURE `migratedriving`( IN pCode VARCHAR(50) ) BEGIN INSERT INTO `employeedriving` ( `employeeCode`, `license`, `lice...
    
            Error Code: 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 'DECLARE v_finished INTEGER  DEFAULT 0;
              DECLARE drivingID BIGINT(20);
    
    
    
         D' at line 36
    
    0 回复  |  直到 6 年前