declare
-- lsql varchar2(2000);
bureausn varchar2(50);
internal_no varchar2(100);
org_id varchar2(100);
item_id varchar2(100);
user_name varchar2(50);
info_type varchar2(10) ;
description varchar2(4000);
no varchar2(50);
status varchar2(10);
department_guids varchar2(50);
count number(10);
begin
--如果是行政许可
if :new.BUTEAUTYPE = 1 then
select i.internal_no ,i.org_id ,i.item_id ,d.personname ,d.status ,d.notifycontent ,e.department_guid into internal_no,org_id,item_id,user_name,info_type,description,department_guids from inf_user_duban d,risenet_employee e,inf_apply i where d.clerkguid = e.employee_guid and d.workflowinstance_guid = i.workflowinstance_guid and i.workflowinstance_guid =:NEW.WORKFLOWINSTANCE_GUID;--and rownum<2;
--如果是行政处罚
else
select i.internal_no internal_no,i.org_id org_id,i.item_id item_id,d.personname user_name,d.status info_type,d.notifycontent DESCRIPTION,e.department_guid into internal_no,org_id,item_id,user_name,info_type,description,department_guids from inf_user_duban d,risenet_employee e,inf_punish i where d.clerkguid = e.employee_guid and d.workflowinstance_guid = i.workflowinstance_guid and i.workflowinstance_guid =:NEW.WORKFLOWINSTANCE_GUID ;--and rownum<2;--execute immediate lsql;
end if;
select sq_inf_supervise.nextval into no from dual;
select bureausn into bureausn from spm_bureau where department_guids= (select distinct department_guid from risenet_department where department_guid in(select distinct y.superior_guid from risenet_department y where y.department_guid in (select e.department_guid from inf_user_duban d,risenet_employee e,inf_apply i where d.clerkguid = e.employee_guid and d.workflowinstance_guid = i.workflowinstance_guid and d.workflowinstance_guid =:NEW.WORKFLOWINSTANCE_GUID)));
bureausn:=bureausn||no;
case info_type when '1' then status:='2' ; else status:='4' ; end case;
insert into inf_supervise(no,internal_no,org_id,item_id,user_name,info_type,description) values(bureausn,internal_no,org_id,item_id,user_name,info_type,description);exception
when no_data_found then
count := 1;end;
-- lsql varchar2(2000);
bureausn varchar2(50);
internal_no varchar2(100);
org_id varchar2(100);
item_id varchar2(100);
user_name varchar2(50);
info_type varchar2(10) ;
description varchar2(4000);
no varchar2(50);
status varchar2(10);
department_guids varchar2(50);
count number(10);
begin
--如果是行政许可
if :new.BUTEAUTYPE = 1 then
select i.internal_no ,i.org_id ,i.item_id ,d.personname ,d.status ,d.notifycontent ,e.department_guid into internal_no,org_id,item_id,user_name,info_type,description,department_guids from inf_user_duban d,risenet_employee e,inf_apply i where d.clerkguid = e.employee_guid and d.workflowinstance_guid = i.workflowinstance_guid and i.workflowinstance_guid =:NEW.WORKFLOWINSTANCE_GUID;--and rownum<2;
--如果是行政处罚
else
select i.internal_no internal_no,i.org_id org_id,i.item_id item_id,d.personname user_name,d.status info_type,d.notifycontent DESCRIPTION,e.department_guid into internal_no,org_id,item_id,user_name,info_type,description,department_guids from inf_user_duban d,risenet_employee e,inf_punish i where d.clerkguid = e.employee_guid and d.workflowinstance_guid = i.workflowinstance_guid and i.workflowinstance_guid =:NEW.WORKFLOWINSTANCE_GUID ;--and rownum<2;--execute immediate lsql;
end if;
select sq_inf_supervise.nextval into no from dual;
select bureausn into bureausn from spm_bureau where department_guids= (select distinct department_guid from risenet_department where department_guid in(select distinct y.superior_guid from risenet_department y where y.department_guid in (select e.department_guid from inf_user_duban d,risenet_employee e,inf_apply i where d.clerkguid = e.employee_guid and d.workflowinstance_guid = i.workflowinstance_guid and d.workflowinstance_guid =:NEW.WORKFLOWINSTANCE_GUID)));
bureausn:=bureausn||no;
case info_type when '1' then status:='2' ; else status:='4' ; end case;
insert into inf_supervise(no,internal_no,org_id,item_id,user_name,info_type,description) values(bureausn,internal_no,org_id,item_id,user_name,info_type,description);exception
when no_data_found then
count := 1;end;
解决方案 »
- oracle新手调试程序,有了以后不用纠结了!
- 利用plsql 如何获得指定目录下的文件信息?
- 此sql语句如何优化,1千万条数据中查需要7,8分钟
- 一条sql语句去重复的记录的问题 高手帮解决
- 关于一个查询语句!请大家帮尽快看一下,怎么写效率高一些.
- 两张表做联结,怎么才能查询第m到第n条的记录啊
- oracle 10g 该用PL/SQL Developer 的哪个版本?
- 还是sql的问题
- developer总怎么样是实现按一个回车就触发!!!
- oracle Bundle Patch p13928776_10204 Windows修复教程
- 大家帮忙看一下这个触发器是什么意思?谢谢
- 如何还原数据库中的某个表?
就是先判断BUTEAUTYPE的新值,然后再查询相关信息。后面太乱