最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
sql 存储过程实例教程
时间:2009-08-26 编辑:简简单单 来源:一聚教程网
Is
dEndTime date; -- 每次处理是时间点
cursor c_cmpp_submit(endTime date) is
select id from cmpp_submit
where ((ih_process <> 'insert_cmpp_submit' and ih_process <> 'wait_for_response')
or (ih_process = 'wait_for_response' and ih_retry <= 0))
and ih_timestamp < endTime and rownum<100001 ;
iCount number; -- 计数器
begin
dEndTime := trunc(SYSDATE,'mi'); -- 取得处理时间点
loop
fetch c_cmpp_submit into iId;
exit when c_cmpp_submit%notfound;
delete from cmpp_submit where id=iId;
begin
commit;
end;
end if;
end loop; -- end of loop
close c_cmpp_submit;
EXCEPTION
WHEN OTHERS THEN
BEGIN
rollback;
if c_cmpp_submit%isopen then
close c_cmpp_submit;
end if;
WHEN OTHERS THEN
NULL;
END;
end CMPP_SUBMIT_REMOVE_PROCEDURE;
这是一款数据库的存储过程实例教程
-
上一个: MyISAM和InnoDB区别
相关文章
- sql存储过程实例与相关基础知识 11-25
- Sqlserver 存储过程 事务实例代码 06-13
- mssql 存储过程入门与实例应用 05-18
- MySQL登录、访问及退出操作解析 10-18
- sql语句 update字段null不能用is null问题解析 09-28
- SQL Server ISNULL 不生效原因及解决分析 09-28