17,377
社区成员
发帖
与我相关
我的任务
分享
Create PROCEDURE dbo.proc_texttest (
v_id in number,
v_text in char(1),
v_opinion in varchar2(500)
)
as
v_applyID number;
v_textSerial number;
v_flag number := 0;
begin
select ApplyID, textSerial
into v_applyID, v_textSerial
from textFlow
where id = v_id;
if v_text = 'V' then
update test t1
SET t1.text=PAUDIT
where exists( select 1
from ApplyInfo t2, AuditFlow t3
where t1.AppID = t2.ID
and t2.ID = t3.ApplyID(+)
and t3.id = v_id);
else if v_text = 'Y' then
select count(id) into v_flag from textFlow where ApplyID = v_applyID and textSerial > v_textSerial;
if v_flag = 0 then
update UserApplyInfo set state = v_text where ID = v_applyID;
update test set text = v_text where AppID =v_applyID;
else
update textFlow set ArriveDate=sysdate where ApplyID = v_applyID and textSerial=v_textSerial+1;
end if;
else if v_text='N' then
select count(id) into v_flag
from textFlow
where ApplyID = v_applyID
and textSerial > v_textSerial
and text <> 'N';
if v_flag > 0 then
dbms_output.put_line('无法审核!');
else
select count(id) into v_flag
from textFlow
where ApplyID = v_applyID
and textSerial > v_textSerial
and text='N';
if v_flag > 0 then
update UserApplyInfo set state=v_text where id = v_id;
update test set text=v_text where AppID=v_applyID;
end if;
end if;
end if;
update textFlow set text=v_text,Opinion=v_opinion,FinishDate=sysdate where id = v_id;
exception
when others then
rollback;
raise;
end proc_texttest;