我有一个问题,因为我想在 mysql 示例中使用程序:
DELIMITER $$
CREATE PROCEDURE `scoreS`()
BEGIN
PREPARE stmt FROM @scoreS;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END
以及具有此过程的示例代码:
SET @results2 = 0;
SET @scoreS = CONCAT("SELECT CommentsId INTO @results2 FROM `",tableName,"` WHERE CRC32 = ",Crc32," ORDER BY CommentsId DESC LIMIT 1");
CALL scoreS();
我想改用这个程序:
SET @results2 = 0;
SET @scoreS = CONCAT("SELECT CommentsId INTO @results2 FROM `",tableName,"` WHERE CRC32 = ",Crc32," ORDER BY CommentsId DESC LIMIT 1");
PREPARE stmt FROM @scoreS;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
现在我不知道我什么时候使用这个程序动作会更快添加记录??