mysql 存储过程 ,如果连续调用一万次这个存储过程,会很慢,求解!!!!!!!!!!!

DELIMITER $$

USE `ddd`$$

DROP PROCEDURE IF EXISTS `cc`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `cc`(IN p_strRealName VARCHAR(50) ,IN p_strNo VARCHAR(20) , IN p_note VARCHAR(18), IN p_dateline INT(8))
BEGIN
	SET @X = 0;
	
          SELECT COUNT(*) AS b INTO @X FROM cc WHERE strRealName = p_strRealName AND strNo = p_strNo AND note= p_note ;
          
          IF(@X <= 0) THEN
          
		INSERT INTO cc SET  strRealName = p_strRealName,  strNo = p_strNo , note= p_note,dateline= p_dateline ;
			
          END IF;		
			
    END$$

DELIMITER ;

  

 

    就想先判断一下数据是否,如存在则不插入,否则插入!

   

 

 

posted @ 2012-08-06 17:51  flex_fly  阅读(1491)  评论(0编辑  收藏  举报