CREATE OR REPLACE PROCEDURE DEVICE.PUpdateMachineHouseMAP
(vczygh in varchar2,tablename in varchar2)
as
cursor cur1 is
select name,stationhouseid,caption,parentname,controltype,facttype,queueid,rackid,
top,left,width,height,hint,showhint,color,flag,remark,userid,modifydate,append,font
from Device.Tstationhousemaptemp where czygh=vczygh;
mm number(8);
begin
for v_cut in cur1 loop
execute immediate 'select count(name) from '||tablename||' where name='||v_cut.NAME into mm;
if mm=1 then
update Device.Tstationhousemap11 set caption=v_cut.CAPTION,parentname=v_cut.PARENTNAME,
queueid=v_cut.QUEUEID,rackid=v_cut.RACKID,top=v_cut.TOP,left=v_cut.LEFT,width=v_cut.width, height=v_cut.height,hint=v_cut.hint,showhint=v_cut.showhint,color=v_cut.color,flag=v_cut.flag,
remark=v_cut.remark,userid=v_cut.userid,modifydate=v_cut.modifydate,font=v_cut.font
where name=v_cut.name;
elsif mm=0 then
insert into Device.Tstationhousemap11 select name,stationhouseid,caption,parentname,controltype,facttype,
queueid,rackid,top,left,width,height,hint,showhint,null,color,flag,remark,userid,modifydate,append,font
from Device.Tstationhousemaptemp where name=v_cut.name and czygh=vczygh;
end if;
end loop;
end;
/
execute 'select count(name) into mm from '||tablename||' where name=MNAME';
改成
execute 'select count(name) from '||tablename||' where name=mname_t' using MNAMW into mm;
这句不能编译:报错
Encountered the symbol "select count(name) into mm from " when expecting one of the following : := .( 0 immediate the symbol ":=" was subtituted for "select count(name) into mm from" to continue
CREATE OR REPLACE PROCEDURE DEVICE.PUpdateMachineHouseMAP
(vczygh in char,tablename in char)
as
cursor cur1 is
select name,stationhouseid,caption,parentname,controltype,facttype,queueid,rackid,
top,left,width,height,hint,showhint,color,flag,remark,userid,modifydate,append,font
from Device.Tstationhousemaptemp where czygh=vczygh;
mm number(8);
begin
OPEN cur1;
loop
begin
fetch cur1 into MNAME,MSTATIONHOUSEID,MCAPTION,MPARENTNAME,MCONTROLTYPE,MFACTTYPE,MQUEUEID,MRACKID,MTOP,MLEFT,MWIDTH,
MHEIGHT,MHINT,MSHOWHINT,MCOLOR,MFLAG,MREMARK,MUSERID,MMODIFYDATE,MAPPEND,MFONT;
Exit when cur1%notfound ;
execute 'select count(name) into mm from '||tablename||' where name=MNAME';
if mm=1 then
update Device.Tstationhousemap11 set caption=MCAPTION,parentname=MPARENTNAME,
queueid=MQUEUEID,rackid=MRACKID,top=MTOP,left=MLEFT,width=Mwidth,
height=Mheight,hint=Mhint,showhint=Mshowhint,color=Mcolor,flag=Mflag,
remark=Mremark,userid=Muserid,modifydate=Mmodifydate,font=Mfont
where name=Mname;
else
if mm=0 then
insert into Device.Tstationhousemap11 select name,stationhouseid,caption,parentname,controltype,facttype,
queueid,rackid,top,left,width,height,hint,showhint,null,color,flag,remark,userid,modifydate,append,font
from Device.Tstationhousemaptemp where name=Mname and czygh=vczygh;
end if;
end if;
end;
end loop;
close cur1;