oracle大量插入数据很慢,大量数据插入数据库老慢老慢 高手指点一下不 先谢了...

create or replace procedure impjfport(machineroom in varchar2)  is

v_jfid  temp_k_jfinfo.jfid%type;

v_jfcol temp_k_jfinfo.jfcol%type;

v_jfmk  temp_k_jfinfo.jfmk%type;

v_jfdz  temp_k_jfinfo.jfdz%type;

v_jfdztype  temp_k_jfinfo.jfdztype%type;

v_jftype   temp_k_jfinfo.jftype%type;

v_jfsysnum  tcs_s_box.ssysserialnum%type;

v_sysid   tcs_s_machineroom.sysid%type;

v_citycode tcs_s_machineroom.citycode%type;

v_state    temp_k_jfinfo.state%type;

v_id       temp_k_jfinfo.id%type;

singport    varchar2(50);

V_STR1       varchar2(16):='0000000000000000';

V_STR2       varchar2(3):='000';

V_STR3       varchar2(3):='000';

V_STR4       varchar2(5):='00000';

jfidlgh  int:=0;

jfcollgh int:=0;

jfmklgh  int:=0;

jfdzlgh  int:=0;

v_count  int:=0;

v_coutjf integer:=0;

cursor c_jf is

select  id,jfid, jfcol, jfmk, jfdz, jfdztype, jftype, state  from temp_k_jfinfo ;

begin

open c_jf;

loop

fetch c_jf into v_id,v_jfid,v_jfcol,v_jfmk,v_jfdz,v_jfdztype,v_jftype,v_state;

exit when c_jf%notfound;

select count(*) into v_coutjf from tcs_s_machineroom t where trim(t.roomcode)=trim(v_id);

if v_coutjf =1 then

--sysid citycode

select t.sysid,t.citycode into v_sysid,v_citycode from tcs_s_machineroom t where trim(t.roomcode)=trim(v_id);

--length()

jfidlgh:=length(trim(v_jfid));

jfcollgh:=length(trim(v_jfcol));

jfmklgh:=length(trim(v_jfmk));

jfdzlgh:=length(trim(v_jfdz));

--create prot

singport:=substr(V_STR1,1,16-jfidlgh)||trim(v_jfid)||'*'||substr(V_STR2,1,3-jfcollgh)||trim(v_jfcol)

||'*'||substr(V_STR3,1,3-jfmklgh)||trim(v_jfmk)

||'*'||substr(V_STR4,1,5-jfdzlgh)||trim(v_jfdz);

--jfsysnum

select count(t.ssysserialnum) into v_count  from tcs_s_box t where trim(t.shelfnum)=trim(v_jfid) and trim(t.roomcode)=trim(v_sysid);

if v_count=0 then

insert into err_id values('这个设备不存在','temp_jfinfo',v_jfid,v_jfid,'交接箱分线盒的外连接表');

else

select t.ssysserialnum into v_jfsysnum from tcs_s_box t where trim(t.shelfnum)=trim(v_jfid) and trim(t.roomcode)=trim(v_sysid);

--equ

if (v_jfdztype='A' or v_jfdztype='a') then

insert into tcs_s_connectboxequport

values(S_HC_RS_EQ_CONNECTBOXEQU.Nextval,v_jfsysnum,v_jfdz,'',v_state,'未预留','未连接','未连接','未使用',v_jfcol,v_jfmk,singport,'','','','','');

end if;

--user

if (v_jfdztype='B' or v_jfdztype='b') then

insert into tcs_s_connectboxuser

values(S_HC_RS_EQ_CONNECTBOXS1.Nextval,v_jfsysnum,v_jfdz,'',v_state,'未连接','未预留','未连接','未使用',v_jfcol,v_jfmk,singport,'','','','','');

end if;

end if;

else

insert into err_id values('机房编号不正确','temp_jfinfo',v_jfid,v_jfid,'交接箱分线盒的端子表');

end if;

end loop;

commit;

close c_jf;

exception

when others then

dbms_output.put_line('交接箱不存在:'||v_jfid);

end impjfport;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值