现在的位置: 首页 > 综合 > 正文

Oracle–存储过程

2012年11月23日 ⁄ 综合 ⁄ 共 433字 ⁄ 字号 评论关闭

1、存储过程写法

create or replace procedure HVM_BYQ_TJ

--变压器统计信息--->入库
(id in number)
as
begin
  for num in 1..2 loop
  if num=1 then
  update hvm_zsb_tj set byq=(select count(0) as hangshu from hvm_view_ObjectZTPJ_Byq t where t.StsRes = '正常状态' and t.bdzdydj = '500kV') where id=1;
  end if;
  if num=2 then
    update hvm_zsb_tj set byq=(select count(0) as hangshu from hvm_view_ObjectZTPJ_Byq t where t.StsRes = '注意状态' and t.bdzdydj = '500kV') where id=2;
  end if;
  end loop;

end HVM_BYQ_TJ;

2、调用

call  HVM_BYQ_TJ(1);

抱歉!评论已关闭.