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;