日期:2014-05-16 浏览次数:20449 次
INSERT INTO sy_api_c_meter (task_id, meter_id, .... .) SELECT in_task_id, meter_id,.. .. FROM c_meter a, c_mp b, c_meter_mp_rela c WHERE a.meter_id = c.meter_id AND b.mp_id = c.mp_id AND b.cons_id = v_cons_id AND b.org_no = v_org_no
FOR cur IN (SELECT c.meter_id FROM c_mp b, c_meter_mp_rela c WHERE b.mp_id = c.mp_id AND b.cons_id = v_cons_id AND b.org_no = v_org_no) LOOP INSERT INTO sy_api_c_meter (task_id, meter_id, inst_loc,....) SELECT in_task_id, meter_id, .... FROM c_meter a WHERE a.meter_id = cur.meter_id; END LOOP;