首先确定nrelationid,nbusinessid类型,若是字符型str:='insert into t_relate_ad_bus_'||ptype||'(id,nrelationid,nbusinessid,dcreatetime,dremovetime) values(SEQ_relate_ad_bus_'||ptype||'.nextval,'''||nbusinessid||''','''||nadminid||''',sysdate,to_date('30-12-9999','dd-mm-yyyy'))';若是数字型 str:='insert into t_relate_ad_bus_'||ptype||'(id,nrelationid,nbusinessid,dcreatetime,dremovetime) values(SEQ_relate_ad_bus_'||ptype||'.nextval,'||nbusinessid||','||nadminid||',sysdate,to_date('30-12-9999','dd-mm-yyyy'))';
str:='select nparent from t_structure_admin where id='''||np||''''; execute immediate str into nadminid ;
编译的时候不是这么出问题吧? 好像是错误处理的那个地方(exception)有问题哦
在例外事件语句部分多加begin...end; exception when no_data_found then begin --语句; end; end;
问题解决了,不是那里的问题,是要在loop和end loop之间加begin 和 end 呵呵
奇怪了。 loop begin .... exception when no_data_found then .... end; end;那多了一个end;
str:='insert into t_relate_ad_bus_'||ptype||'(id,nrelationid,nbusinessid,dcreatetime,dremovetime) values(SEQ_relate_ad_bus_'||ptype||'.nextval,'||nbusinessid||','||nadminid||',sysdate,to_date('30-12-9999','dd-mm-yyyy'))';
execute immediate str into nadminid ;
好像是错误处理的那个地方(exception)有问题哦
exception
when no_data_found then
begin
--语句;
end;
end;
呵呵
loop
begin
....
exception
when no_data_found then
....
end;
end;那多了一个end;