为了初始化数据写了个sql,放入oracle中居然执行了40分钟,在sqlserver和mysql中居然几秒就完事了。

insert into oa_system_remind select HIBERNATE_SEQUENCE.NEXTVAL,e.emp_id,
 (select count(m.mailuser_id) from EZOFFICE.oa_mail_user m where (m.mailstatus = 1 and m.NOTREAD = 1)
 and m.mail_id is not null and m.emp_id = e.emp_id),
 (select count(w.wf_work_id) from EZOFFICE.wf_work w where w.workStatus = 0 and  w.wf_curEmployee_id = e.emp_id

and w.workListControl = 1),
 (select count(wf_work_id) from EZOFFICE.wf_work w2 where w2.workStatus = 2 and  w2.wf_curEmployee_id = e.emp_id

and w2.workListControl = 1),
 (select count(wf_work_id) from EZOFFICE.wf_work w3 where w3.workStatus = 0 and w3.workDeadLine<>-1 and

w3.wf_curEmployee_id = e.emp_id  and w3.workListControl = 1 and sysdate > w3.workDeadlineDate )
  from org_employee e where e.userisdeleted=0;

你可能感兴趣的:(oracle,sql,Hibernate,mysql,sqlserver,insert)