declare
cursor c1 is select ISETID AS ID1 , ISETID1 as ID2 From (select ISetID, ItemsID from FI where ISetID in (Select ISetId from FI group by ISetID having count(ItemsID)=1)) natural join ( select ISetID as IsetID1,ItemsID from FI where ISetID in (Select ISetId from FI group by ISetID having count(ItemsID)=3));
v_sf_l number ;
v_sf_b number;
v_confi number;
v_name_l varchar(200);
v_name_b varchar(200);
begin
for I in c1 loop
select distinct sf into v_sf_l from FI where IsetID=I.id1;
select distinct sf into v_sf_b from FI where IsetID=I.id2;
v_confi:=v_sf_b/v_sf_l;
select distinct wm_concat(ItemsName) into v_name_l from FI,items where IsetID=I.id1 and FI.ItemsID =Items.ItemsID;
select distinct replace(wm_concat(ItemsName),v_name_l,'') into v_name_b from FI,items where IsetID=I.id2 and FI.ItemsID =Items.ItemsID;
v_name_b:=trim(replace(v_name_b,',',' '));
execute immediate('Insert into apr(name1,name2,conf) values ('||v_name_l||','||v_name_b||','||v_confi||')');
dbms_output.put_line(v_name_l||','||v_name_b||','||v_confi);
end loop;
end;
/
每当我执行此脚本时,当我使用 dbms_output.put_line 时,执行立即插入时会出现逗号丢失错误!!!!