delete from ACT_GE_BYTEARRAY where ID_ in (select BYTEARRAY_ID_ AS ID_ from ACT_HI_VARINST where BYTEARRAY_ID_ IS NOT NULL AND PROC_INST_ID_ = processInstanceId);
delete from ACT_EVT_LOG where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_ACTINST where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_ATTACHMENT where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_COMMENT where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_DETAIL where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_PROCINST where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_TASKINST where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_IDENTITYLINK where PROC_INST_ID_ = processInstanceId;
delete from ACT_HI_VARINST where PROC_INST_ID_ = processInstanceId;
delete ACT_GE_BYTEARRAY where ID_ in (select BYTEARRAY_ID_ from ACT_HI_VARINST where BYTEARRAY_ID_ IS NOT NULL AND PROC_INST_ID_ = @processInstanceId);
delete ACT_EVT_LOG where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_ACTINST where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_ATTACHMENT where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_COMMENT where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_DETAIL where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_PROCINST where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_TASKINST where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_IDENTITYLINK where PROC_INST_ID_ = @processInstanceId;
delete ACT_HI_VARINST where PROC_INST_ID_ = @processInstanceId;
END
复制代码
创建存储过程sp_delete_ru
CREATE PROC sp_delete_ru
@processInstanceId varchar(128)
AS
BEGIN
-- 删除 ru 表数据
delete ACT_RU_DEADLETTER_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
delete ACT_RU_EVENT_SUBSCR where PROC_INST_ID_ = @processInstanceId;
delete ACT_RU_INTEGRATION where PROCESS_INSTANCE_ID_ = @processInstanceId;
delete ACT_RU_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
delete ACT_RU_SUSPENDED_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
delete ACT_RU_TASK where PROC_INST_ID_ = @processInstanceId;
delete ACT_RU_TIMER_JOB where PROCESS_INSTANCE_ID_ = @processInstanceId;
select BYTEARRAY_ID_ as ID_ into temp_byte_ids from ACT_RU_VARIABLE where BYTEARRAY_ID_ IS NOT NULL AND PROC_INST_ID_ = @processInstanceId;
delete ACT_RU_VARIABLE where PROC_INST_ID_ = @processInstanceId;
delete ACT_GE_BYTEARRAY where ID_ in (select * from temp_byte_ids);
drop table temp_byte_ids;
delete ACT_RU_IDENTITYLINK where PROC_INST_ID_ = @processInstanceId;
delete ACT_RU_EXECUTION where PROC_INST_ID_ = @processInstanceId;