我写的。
保存点(SAVEPOINT)是事务处理过程中的一个标志,与回滚命令(ROLLBACK)结合使用,主要的用途是允许用户将某一段处理回滚而不必回滚整个事务。
如果定义了多个savepoint,当指定回滚到某个savepoint时,那么回滚操作将回滚这个savepoint后面的所有操作(即使后面可能标记了N个savepoint)。
例如,在一段处理中定义了五个savepoint,从第三个savepoint回滚,后面的第四、第五个标记的操作都将被回滚,如果不使用ROLLBACK TO savepoint_name而使用ROLLBACK,将会滚整个事务处理。
create or replace procedure TL_Parameters_Delete (projectid integer, schemeid integer) is strsql varchar(500); begin savepoint point1; --===1系统设置表=== strsql:= 'delete from TL_XTSZPRO where id in (select id from TL_XTSZPRO where evprojectid='||projectid||' and evschemeid='||schemeid||')'; execute immediate strsql;--执行 savepoint point2; --===2交叉表=== strsql:='delete from tl_jckypro where id in ( select id from tl_jckypro where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point3; ---===3导地线===TL_DDXPRO strsql:='delete from tl_ddxpro where id in ( select id from tl_ddxpro where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point4; ---==4气象区===气象区工程关联表TL_ QXQPRO strsql:='delete from TL_QXQPRO where id in ( select id from TL_QXQPRO where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point5; ----===5杆塔工程关联表===TL_TOWERPRO strsql:='delete from TL_TOWERPRO where id in ( select id from TL_TOWERPRO where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point6; --====6分段设置表===TL_FDSZPRO strsql:='delete from TL_FDSZPRO where id in ( select id from TL_FDSZPRO where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point7; ---===绝缘子工程关联表TL_INSULATORPRO=== strsql:='delete from TL_INSULATORPRO where id in ( select id from TL_INSULATORPRO where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point8; --===接地装置参数表 TL_GROUNDDEVICEPRO=== strsql:='delete from TL_GROUNDDEVICEPRO where id in ( select id from TL_GROUNDDEVICEPRO where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point9; --===防震锤参数表TL_FZCCSPRO=== strsql:='delete from TL_FZCCSPRO where id in ( select id from TL_FZCCSPRO where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point10; --===设计和优化计算表TL_SJHYHJSPRO=== strsql:='delete from TL_SJHYHJSPRO where id in ( select id from TL_SJHYHJSPRO where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point11; ---===价格及损耗表TL_JGJSHPRO=== strsql:='delete from TL_JGJSHPRO where id in ( select id from TL_JGJSHPRO where evprojectid='||projectid||' and evschemeid='||schemeid ||')'; execute immediate strsql;--执行 savepoint point12; exception when others then rollback to savepoint point1; return; dbms_output.put_line(strsql); end TL_Parameters_Delete;