标签:.sh null false and close mode while OLE proc
1 procdure 存储过程 用游标循环设备注册代码
not in (select ems.tbl_user_dev.user_dev_sn open cur;
while(flg) do
FETCH cur into devsn,name,serialNo,nextIntime,fcloor,propertyName,maintainName;
if(flg) then
insert into tbl_user_dev (tbl_user_dev.user_dev_sn,
tbl_user_dev.factory_no,
tbl_user_dev.user_dev_model_id,
tbl_user_dev.maintenance_organization_id,
tbl_user_dev.using_organization_id)
select devsn,serialNo,
(select tbl_user_dev_model.id from tbl_user_dev_model where tbl_user_dev_model.model_name=name),
(select tbl_org.id from tbl_org where tbl_org.org_name=maintainName and tbl_org.org_type=‘01‘),
(select tbl_org.id from tbl_org where tbl_org.org_name=propertyName and tbl_org.org_type=‘02‘);
insert into tbl_elevator (
tbl_elevator.user_dev_id,
tbl_elevator.nextin_spection_date,
tbl_elevator.floor )
select (select tbl_user_dev.id from tbl_user_dev where tbl_user_dev.user_dev_sn=devsn),
nextIntime,
fcloor;
end if;
end WHILE;
close cur;
end
// 注意:当插入的值要去继续查找时要用select 而不是 values() 而且将select的结果用扩好括起来
标签:.sh null false and close mode while OLE proc
原文地址:http://blog.51cto.com/13479316/2136175