[code="sql"]
create or replace procedure stgxForJob
is
begin
--将新实体的基本信息插入实体表
insert into stxx2 select st.nbxh, 'A','',sysdate, sysdate, to_date('3000-12-31','yyyy-mm-dd'),'0','0','0','0','','','' from stxx1 st where st.nbxh not exists (select distinct(a.nbxh) from stxx2 b);
commit;
exception
when others then
rollback;
end;
[/code]
第一次执行时 stxx2为空表 执行后 因有后续操作 stxx2数据量在第一次执行外会大于stxx1
因为最近传回数据库频繁锁死的情况 目前正在找原因
请问这样的语句该如何优化