Oracle存储过程

本文介绍了一个用于取消次品单信息的PL/SQL存储过程,该过程能够更新次品单的状态,并同步调整相关影像文件的有效性标志。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、 在plsql中新建包,在包中定义存储过程:

create or replace package L_IMAGE_CORE is                                 

--******************************************
  --功能说明:取消次品单信息
  --修改次品单总信息及次品单详细信息的有效状态为'Y',
  --如果是缺少的文件,则需要修改单类影像文件索引表(IMAGE_DOC_INDEX)中有效状态为'Y'
  --次品单在未处理的情况下,不对同一单下发多次,返回标识提醒,但不返回异常
  --下发次品单同时将对应影像是否有效设置为N
  --参数说明:
  --输入:
  --  次品单流水号 
  --输出:
  -- p_sign  执行结果:Y-成功;N-失败;E-存在未处理
  -- p_message 结果描述
  --修改记录:
  -- create by xxxxx
--******************************************
procedure quash_failed_info(p_image_failed_no IN VARCHAR2,
                            p_sign OUT VARCHAR2,
                            p_message OUT VARCHAR2) IS
   v_err_code VARCHAR2(10);
   v_prompt   VARCHAR2(1000); 
   v_count    INTEGER;
   --v_return_reason  image_failed_detail.return_reason%type;
   --select image_failed_detail.document_id from image_failed_detail where image_failed_detail.image_failed_no=p_image_failed_no;
 begin
   select count(ifd.document_id) into v_count from image_failed_detail ifd where ifd.image_failed_no=p_image_failed_no;
   if(v_count=0) then
      p_sign    := 'N';
      p_message := '传入的次品单号不存在。';
      return;
   end if;
   begin
      update image_failed_detail ifd set ifd.deal_flag  = 'Y'  where ifd.image_failed_no=p_image_failed_no;
      update image_failed imf set imf.failed_deal_status = 'Y' where imf.image_failed_no=p_image_failed_no;
      update image_doc_index idi set idi.valid_flag='Y' where idi.document_id in 
     (select ifd.document_id from image_failed_detail ifd  where ifd.image_failed_no=p_image_failed_no 
      and (ifd.return_reason='9000' or ifd.return_reason='9001'));
      --commit;
      p_sign  := 'Y';
      p_message := '次品单撤销成功!'; 
   end;
Exception
   when others then
     p_sign    := 'N';
     p_message := SUBSTRB('修改页码时异常:' || SQLERRM, 1, 500);
     -- Logging the error
     v_err_code := NULL;
     pub_error_handle.exception_no_raise('L_IMAGE_CORE.quash_failed_info',
                                        v_err_code,
                                        p_message,
                                        v_prompt);                       
end quash_failed_info;                    
end L_IMAGE_CORE;



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值