一个带输入、输出参数是存储过程的写法及调用

create or replace procedure delete_BulkMaterial(
     code in BO_INVOICEREGIS_S.STORAGECODE%TYPE,
     count out int
  )
  is
  temp number;
  begin
    select  count(*) into temp from BO_INVOICEREGIS_S where BO_INVOICEREGIS_S.STORAGECODE =code;
    --发票中没有相应的数据可以删除
    if(temp<=0)then
             count :=1;
      delete from BO_COMMODITYINSPECTIONS where ccode=code;
      --不可以删除
    else
             count :=0;
    end if;
  end;

commit;

 --调用

declare
i int;
begin
delete_BulkMaterial('1142012031302',i);
DBMS_OUTPUT.put_line(i);
end;

附:

 oracle 中判断一个存储过程是否执行成功,可以把它编译过的代码再执行一下(有误就会提示的)。

猜你喜欢

转载自numberrbb.iteye.com/blog/1466335