可能还没有表达清楚,如何使第二个SELECT语句触发异常后,在异常处理后,也能接着执行
第二个SELECT 语名后的其它语句直到存贮过程完全执行
第二个SELECT 语名后的其它语句直到存贮过程完全执行
解决方案 »
- ORA-03137: TTC 协议内部错误: [12333] [76] [76] [79] [] [] [] []
- 问个内连接和外连接的基础问题呀
- 存储过程如何返回多条数据?????
- Oracel临时表 表结构会在数据库重启后自动删除吗?
- 关于一个SQL语句的写法
- ORA-01552: 非系统表空间 'USERS' 不能使用系统回退段
- 弱弱的问题.... in和exists =.=!!
- 急求BIBeans开发Oracle数据仓库项目资料!!!
- C++、Oracle、Linux群,号码:14106362,欢迎常在线的高手加入指导
- 怎样插入数据到几个相关联的表!
- 如何查看oracle表的结构,如何更改oracle中表的字段名,急用
- 为什么表不可见?
然后判断v_i是否等于1,如果是执行 select sum(a.sl2) into temp_int2 from table_A a,table_b b where (a.id=b.id);
如:
select count(*) into v_i from table_A a,table_b b where (a.id=b.id);
if v_i=1 then
select sum(a.sl1) into temp_int1 from table_A a,table_b b where (a.id=b.id);
end if;
select count(*) ...
if v_i=1 then ...
...
as
temp_int1 number(4);
temp_int2 number(4);
begin
begin
select sum(a.sl1) into temp_int1 from table_A a,table_b b where (a.id=b.id);
EXCEPTION
WHEN NO_DATA_FOUND THEN
.......
end;
begin
select sum(a.sl2) into temp_int2 from table_A a,table_b b where (a.id=b.id);
EXCEPTION
WHEN NO_DATA_FOUND THEN
.......
end;
end;
聚组函数AVG或SUM用在select into里最多返回的
temp_int1、temp_int2为空,不会产生例外的。
如果贴主还有其他不用SUM的语句在执行,那么
用qiuyang_wang(小数点) 的方式程序比较清晰。
那你就不要用此方法实现了。用以下:
create or replace procedure AAA
as
temp_int1 number(4);
temp_int2 number(4);
begin
select sum(a.sl1) into temp_int1 from table_A a,table_b b where (a.id=b.id);
if temp_int1 is null then
...
end if;
select sum(a.sl2) into temp_int2 from table_A a,table_b b where (a.id=b.id);
if temp_int2 is null then
....
end if;
...
end;
/