MYSQL PROCEDURE 问题 急救 SOS 谢谢

我把一个存储过程的创建语句复制下来,然后删了重新建立 ,结果一直报错,而且报的还是语法错误,死活没找到到底哪里出错,SOS ,谢谢谢谢
报错行为我加粗的那一行

[Err] 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 30

 CREATE DEFINER=`root`@`loaclhost` PROCEDURE `P_SIG_INFO_MANAGEMENT`(IN vi_db_method VARCHAR(253),
        IN vi_sig_id VARCHAR(253) ,
        IN vi_sig_name_cn VARCHAR(253) CHARACTER SET utf8,
        IN vi_sig_name_en VARCHAR(253) ,
        IN vi_sig_action_id INT(11) ,
        IN vi_sig_protocol VARCHAR(253),
        IN vi_sig_version VARCHAR(8),
        IN vi_sig_encrypt DECIMAL(1),
        IN vi_sig_direction VARCHAR(253),
        IN vi_sig_port VARCHAR(253),
        IN vi_sig_type VARCHAR(253),
        IN vi_sig_priority INT(11),
        IN vi_sig_option DECIMAL(1),
        IN vi_sig_genlog INT(11),
        IN vi_sig_match_main VARCHAR(1024),
--        IN vi_sig_match_2 VARCHAR(1024),
--        IN vi_sig_match_3 VARCHAR(1024),
        IN vi_sig_audit_support DECIMAL(1),
--        IN vi_sig_createtime DATETIME,
--        IN vi_sig_modifytime DATETIME,
        IN vi_sig_author VARCHAR(253),
        IN vi_sig_author_list VARCHAR(1024),
        IN vi_sig_update_history TEXT ,
        IN vi_sig_desc TEXT ,
        IN vi_sig_status DECIMAL(1) ,
        IN vi_sig_app_id INT(11),            IN vi_sig_usrc_corevent DECIMAL(1))
    COMMENT '应用特征信息记录-管理过程.'
BEGIN
        -- local val declared. --
        **DECLARE _ERR_NUM INT(11);**
        DECLARE _ERR_MSG VARCHAR(253);

        DECLARE vi_sig_createtime TIMESTAMP;
        DECLARE vi_sig_modifytime TIMESTAMP;

        -- initial local val.
        SET _ERR_NUM  = 0;
        SET _ERR_MSG = "";

        -- default val given.
    SET vi_sig_createtime = CURRENT_TIME;
    SET vi_sig_modifytime = CURRENT_TIME;

        -- parameters security check. --        
    IF ( vi_sig_author IS NULL) THEN
        SET _ERR_NUM = 2;
        SET _ERR_MSG = '当前修改此应用的用户未明.';
    ELSEIF ( !STRCMP( vi_sig_author , "sapling" )) THEN
            SET _ERR_NUM = 11;
            SET _ERR_MSG = '系统管理员[sapling]不能对库进行操作.';
        END IF;
    -- start to do standard mission.
    IF ( !STRCMP( vi_db_method , "INSERT" )) THEN
            IF ( vi_sig_id IS NULL) THEN
                    SET @SIG_NUM_START = 16777216; -- ( Hex:0x0100 0000   Dec:16777216)
                    -- start to auto generate a sig id to keep unique.
                    SELECT COUNT(T_SIG_ID) INTO vi_sig_id FROM `SAP_ALL_APPS_SIGS`;  -- 计算当前应用特征的总数 --> 10进
                    SET vi_sig_id = @SIG_NUM_START + vi_sig_id + 1 ;                 -- 计算当前新添加的 特征ID --> 10进
                    SET vi_sig_id = CONCAT( "0x0" , CONV( vi_sig_id , 10, 16 ) );   -- 进制转换,并拼接标准头0x0 --> 形成如: 0x01001001 此类特征ID.
            END IF;
            -- start to do insert.
            INSERT INTO `SAP_ALL_APPS_SIGS` ( T_SIG_ID, T_SIG_NAME_CN, T_SIG_NAME_EN,
                                                                                    T_SIG_ACTION_ID,
                                                                                    T_SIG_PROTOCOL,
                                                                                    T_SIG_VERSION,
                                                                                    T_SIG_ENCRYPT,
                                                                                    T_SIG_DIRECTION,T_SIG_PORT,
                                                                                    T_SIG_TYPE,
                                                                                    T_SIG_PRIORITY,
                                                                                    T_SIG_OPTION,
                                                                                    T_SIG_GENLOG,
                                                                                    T_SIG_MATCH_MAIN,
                                                                                    T_SIG_AUDIT_SUPPORT,
                                                                                    T_SIG_CREATETIME, T_SIG_MODIFYTIME,
                                                                                    T_SIG_AUTHOR, T_SIG_AUTHOR_LIST,
                                                                                    T_SIG_UPDATE_HISTORY,
                                                                                    T_SIG_DESC,
                                                                                    T_SIG_STATUS,
                                                                                    T_SIG_APP_ID,
                                          T_SIG_USRC_COREVENT )
                VALUES ( vi_sig_id , vi_sig_name_cn, vi_sig_name_en ,     -- 应用特征ID,中英文三元组
                                vi_sig_action_id,
                                vi_sig_protocol,
                                vi_sig_version,
                                vi_sig_encrypt,
                                vi_sig_direction, vi_sig_port,                    -- 端口,方向 可选项二元组
                                vi_sig_type,
                                vi_sig_priority,
                                vi_sig_option,
                                vi_sig_genlog,
                                vi_sig_match_main,
                                vi_sig_audit_support,
                                vi_sig_createtime, vi_sig_modifytime,             -- 系统时间,自动计算
                                vi_sig_author, vi_sig_author_list,                -- 前者为当前登录系统账户,后者为所有修改过此应用的账户列表
                                vi_sig_update_history,
                                vi_sig_desc,
                                vi_sig_status ,
                                vi_sig_app_id,
                vi_sig_usrc_corevent );                                  -- 应用特征所属应用的ID.(在 sap_all_apps 表中对应)
        ELSEIF ( !STRCMP( vi_db_method , "UPDATE" )) THEN
                IF ( vi_sig_id IS NOT NULL) THEN
                    UPDATE `SAP_ALL_APPS_SIGS`
                        SET T_SIG_NAME_CN = vi_sig_name_cn, T_SIG_NAME_EN = vi_sig_name_en,
                                        T_SIG_ACTION_ID = vi_sig_action_id,
                                        T_SIG_PROTOCOL = vi_sig_protocol,
                                        T_SIG_VERSION = vi_sig_version,
                                        T_SIG_ENCRYPT = vi_sig_encrypt,
                                        T_SIG_DIRECTION = vi_sig_direction, T_SIG_PORT = vi_sig_port,
                                        T_SIG_TYPE = vi_sig_type,
                                        T_SIG_PRIORITY = vi_sig_priority,
                                        T_SIG_OPTION = vi_sig_option,
                                        T_SIG_GENLOG = vi_sig_genlog,
                                        T_SIG_MATCH_MAIN = vi_sig_match_main,
                                        T_SIG_AUDIT_SUPPORT = vi_sig_audit_support,
--                                        T_SIG_CREATETIME = vi_sig_createtime,
                                        T_SIG_MODIFYTIME = vi_sig_modifytime,
                                        T_SIG_AUTHOR = vi_sig_author, T_SIG_AUTHOR_LIST = vi_sig_author_list,
                                        T_SIG_UPDATE_HISTORY = vi_sig_update_history,
                                        T_SIG_DESC = vi_sig_desc,
                                        T_SIG_STATUS = vi_sig_status,
                                        T_SIG_APP_ID = vi_sig_app_id,
                    T_SIG_USRC_COREVENT = vi_sig_usrc_corevent
                        WHERE T_SIG_ID = vi_sig_id;
              END IF;
    ELSE
            SET _ERR_NUM = 11;
            SET _ERR_MSG = '系统管理员[sapling]不能对库进行操作.';
            SELECT CONCAT( _ERR_NUM, " : " , _ERR_MSG  );
    END IF;
END
查看全部
panda620
panda620
2015/07/28 09:12
  • mysql
  • 点赞
  • 收藏
  • 回答
    私信

2个回复