create or replace procedure data_import as num number; begin select count(*) into num from temp_yuangxx a where zhih exists(select zhih from tyuangxx b where a.zhih=b.zhih)) if num>0 then insert into tyuangxx(zhih,xingb,bumh,gangwh,zhuangt,xingm,piaoxh,xianlcxdm) select zhih,rtrim(xingb)as xingb,bumh,gangwh,zhuangt,xingm,piaoxh,xianlcxdm from temp_yuangxx where zhih not in(select zhih from tyuangxx);end if; end;
试试这样: create or replace procedure data_import as begin insert into tyuangxx(zhih,xingb,bumh,gangwh,zhuangt,xingm,piaoxh,xianlcxdm) select zhih,rtrim(xingb)as xingb,bumh,gangwh,zhuangt,xingm,piaoxh,xianlcxdm from temp_yuangxx where zhih not in(select zhih from tyuangxx) and exists(select zhih from temp_yuangxx where zhih not in(select zhih from tyuangxx)); end;
as
num number;
begin
select count(*) into num from temp_yuangxx a where zhih exists(select zhih from tyuangxx b where a.zhih=b.zhih))
if num>0 then
insert into tyuangxx(zhih,xingb,bumh,gangwh,zhuangt,xingm,piaoxh,xianlcxdm)
select zhih,rtrim(xingb)as xingb,bumh,gangwh,zhuangt,xingm,piaoxh,xianlcxdm from temp_yuangxx
where zhih not in(select zhih from tyuangxx);end if;
end;
说的好,它真的笨得死!我以前用SQL Server,写procedure得心应手,现在用oracle,想死了!在PL/SQL里写个小过程都出错。兄弟们有没有好书?望推荐几本,谢谢!
其实我看你们的想法就跟我一样,但我是觉得sqlserver笨得死.多学习是最重要
create or replace procedure data_import
as
begin
insert into tyuangxx(zhih,xingb,bumh,gangwh,zhuangt,xingm,piaoxh,xianlcxdm)
select zhih,rtrim(xingb)as xingb,bumh,gangwh,zhuangt,xingm,piaoxh,xianlcxdm from temp_yuangxx
where zhih not in(select zhih from tyuangxx) and
exists(select zhih from temp_yuangxx where zhih not in(select zhih from tyuangxx));
end;