+ -
当前位置:首页 → 问答吧 → 存储过程的写法

存储过程的写法

时间:2011-11-24

来源:互联网

declare cursor aaa is
select * from a

因为有时候会timeout,如果timeout 则
declare cursor aaa is
select * from b

for bbb in aaa loop
......
end;

怎么实现?

作者: alextoby   发布时间: 2011-11-24

SQL code
加事务的处理!

作者: cosio   发布时间: 2011-11-24

请具体说明,谢谢

作者: alextoby   发布时间: 2011-11-24

使用光标FOR循环罢。


把主要内容放到创建存储过程的体中。
create or replace procedure (形参列表) is

begin
  body代码。
end;

作者: LuiseRADL   发布时间: 2011-11-24

declare cursor aaa is
select * from a
exception when others then
declare cursor aaa is
select * from b

这样写不对

作者: alextoby   发布时间: 2011-11-24

SQL code
select * from a
---看看有没有帮忙优化这个SQL!

作者: cosio   发布时间: 2011-11-24

a 表是在其他服务器上的,所以即便优化也会出现timeout

作者: alextoby   发布时间: 2011-11-24

说一下你的需要,为什么要这样子的操作?

作者: cosio   发布时间: 2011-11-24