mysql过程中的多次插入会引发错误

时间:2015-01-15 11:43:26

标签: mysql

DROP procedure IF EXISTS 'proc_ico_150643';  
DELIMTER $$  
USE 'doc1vault'$$  
CREATE PROCEDURE 'proc_ico_150643'(

)  BEGIN  INSERT 
INTO
    vault_databases
    (ico_index,ico_name,ico_description,socket,ico,status_cd) 
VALUES
    (682,'SOE_ICO_61_271','SOE_PROD_ICO_61_BT LATAM_PROVIDER_PERU_271',16003,'61_271','A');  INSERT 
    INTO
        vault_databases
        (ico_index,ico_name,ico_description,socket,ico,status_cd) 
    VALUES
        (683,'SOE_ICO_61_272','SOE_TEST_ICO_61_BT LATAM_PROVIDER_PERU_272',17003,'61_272','A');  INSERT 
        INTO
            vault_databases
            (ico_index,ico_name,ico_description,socket,ico,status_cd) 
        VALUES
            (684,'SOE_ICO_61_273','SOE_PROD_ICO_61_BT LATAM_PROVIDER_PERU_273',16003,'61_273','A');  INSERT 
            INTO
                vault_databases
                (ico_index,ico_name,ico_description,socket,ico,status_cd) 
            VALUES
                (685,'SOE_ICO_61_274','SOE_TEST_ICO_61_BT LATAM_PROVIDER_PERU_274',17003,'61_274','A');  INSERT 
                INTO
                    vault_databases
                    (ico_index,ico_name,ico_description,socket,ico,status_cd) 
                VALUES
                    (686,'SOE_ICO_61_275','SOE_PROD_ICO_61_BT LATAM_PROVIDER_COLUMBIA_275',16003,'61_275','A');  INSERT 
                    INTO
                        vault_databases
                        (ico_index,ico_name,ico_description,socket,ico,status_cd) 
                    VALUES
                        (687,'SOE_ICO_61_276','SOE_TEST_ICO_61_BT LATAM_PROVIDER_COLUMBIA_276',17003,'61_276','A');  INSERT 
                        INTO
                            vault_databases
                            (ico_index,ico_name,ico_description,socket,ico,status_cd) 
                        VALUES
                            (688,'SOE_ICO_61_277','SOE_PROD_ICO_61_BT LATAM_PROVIDER_COLUMBIA_277',16003,'61_277','A');  INSERT 
                            INTO
                                vault_databases
                                (ico_index,ico_name,ico_description,socket,ico,status_cd) 
                            VALUES
                                (689,'SOE_ICO_61_278','SOE_TEST_ICO_61_BT LATAM_PROVIDER_COLUMBIA_278',17003,'61_278','A');      END$$  DELIMITER ;  ~  ~  ~  ~
  

第2行的错误1064(42000):您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以获得正确的语法,以便使用n ear' proc_ico_150643''在第1行

1 个答案:

答案 0 :(得分:0)

错误实际上在第一行开始。使用反引号来转义名称,而不是引号。

而不是

DROP procedure IF EXISTS 'proc_ico_150643'; 

使用

DROP procedure IF EXISTS `proc_ico_150643`; 

您还需要纠正具有相同问题的这一行

USE `doc1vault` $$  
CREATE PROCEDURE `proc_ico_150643`(