我在数据库中有一个表,以前存在,不知道对所述表的任何更改,最近无法通过存储过程进行更新。收到的错误是“错误代码:1615。准备好的声明需要重新准备。”我试图推断出问题的存储过程是:
DELIMITER //
DROP PROCEDURE IF EXISTS db1.sp_change_dates;//
CREATE DEFINER=`serviceAdmin`@`%` PROCEDURE `db1.sp_change_dates`()
begin
SET @stmt_text = 'update db1.activity set createStamp = (createStamp + interval 1 day);';
PREPARE update_stmt FROM @stmt_text;
EXECUTE update_stmt;
DEALLOCATE PREPARE update_stmt;
END
//
DELIMITER ;
表定义如下:
CREATE TABLE `activity` (
`id` decimal(30,0) NOT NULL,
`v` bigint(20) DEFAULT NULL,
`createStamp` timestamp NULL DEFAULT NULL,
`modifiedStamp` timestamp NULL DEFAULT NULL,
`createdBy` decimal(30,0) DEFAULT NULL,
`modifiedBy` decimal(30,0) DEFAULT NULL,
`DEPRECATED_ownerOrg` decimal(30,0) DEFAULT NULL,
`active` tinyint(1) NOT NULL,
`testData` tinyint(1) NOT NULL DEFAULT '0',
`activityCategoryOid` decimal(30,0) DEFAULT NULL,
`activitySubCategoryOid` decimal(30,0) DEFAULT NULL,
`organization` decimal(30,0) DEFAULT NULL,
`rootActivityOid` decimal(30,0) DEFAULT NULL,
`contact` decimal(30,0) DEFAULT NULL,
`subject` varchar(255) DEFAULT NULL,
`description` varchar(8096) DEFAULT NULL,
`DEPRECATED_referencedItemobjectIdStr` varchar(255) DEFAULT NULL,
`DEPRECATED_referencedItemClazzName` varchar(255) DEFAULT NULL,
`DEPRECATED_referencedItemName` varchar(1000) DEFAULT NULL,
`parentActivityOid` decimal(30,0) DEFAULT NULL,
`fillInDate` timestamp NULL DEFAULT NULL,
`fillInDateHour` datetime DEFAULT NULL,
`fillInLocalDate` datetime DEFAULT NULL,
`fillInLocalDateHour` datetime DEFAULT NULL,
`priority_id` int(11) DEFAULT NULL,
`providerId` decimal(30,0) DEFAULT NULL,
`beginDate` datetime DEFAULT NULL,
`beginDateHour` datetime DEFAULT NULL,
`beginLocalDate` datetime DEFAULT NULL,
`beginLocalDateHour` datetime DEFAULT NULL,
`activityClassEnum` enum('Case','Task','Memo','Opportunity') DEFAULT NULL,
`assignedToOid` decimal(30,0) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_subject` (`subject`),
KEY `idx_fillInDate` (`fillInDate`),
KEY `idx_organization` (`organization`),
KEY `idx_parentActivityOid` (`parentActivityOid`),
KEY `idx_createdBy` (`createdBy`),
KEY `idx_createStamp` (`createStamp`),
KEY `idx_active` (`active`),
KEY `idx_activityCategoryOid` (`activityCategoryOid`),
KEY `idx_modifiedStamp` (`modifiedStamp`),
KEY `idx_contact` (`contact`),
KEY `idx_rootActivityOid` (`rootActivityOid`),
KEY `idx_priorityWeight` (`priority_id`),
KEY `idx_referencedItemobjectIdStr` (`DEPRECATED_referencedItemobjectIdStr`),
KEY `idx_beginDate` (`beginDate`),
KEY `idx_idx_beginDateHour` (`beginDateHour`),
KEY `idx_idx_beginLocalDate` (`beginLocalDate`),
KEY `idx_idx_beginLocalDateHour` (`beginLocalDateHour`),
KEY `idx_idx_fillInDateHour` (`fillInDateHour`),
KEY `idx_idx_fillInLocalDate` (`fillInLocalDate`),
KEY `idx_idx_fillInLocalDateHour` (`fillInLocalDateHour`),
KEY `idx_activitySubCategoryOid` (`activitySubCategoryOid`),
KEY `idx_activityClassEnum` (`activityClassEnum`),
KEY `IDX_id` (`id`),
KEY `IDX_assignedTo_organization` (`assignedToOid`,`organization`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
我在另一个数据库中尝试了这个(我们为多个客户端提供了相同的数据库),并且能够毫无问题地运行存储过程。有问题的数据库正在运行MySQL 5.6.34。我已经看到了一些与此问题类似的错误,但没有一个没有引入另一种软件或语言(例如PHP)。我不知道要搜索什么,并且很乐意提供更多的系统信息,如果这将有所帮助。我最初并没有设计数据库,而是试图在另一个停止的地方找到它。提前致谢。我的用户权限为ALL PRIVILEGES on *.* WITH GRANT OPTION.
答案 0 :(得分:0)
我最终通过将table_definition_cache从2000增加到7900来解决这个问题。