450: a_pm_rule.LIST_DATE ,
451: a_pm_rule.LIST_DATE_DESC ,
452: eam_pm_scheduling_rules_s.nextval);
453:
454: -- if it's a runtime rule, insert meter initial reading into eam_pm_last_services table
455: if a_pm_rule.meter_id is not null then
456:
457: --added for performance issues
458: select initial_reading into l_initial_reading from
465:
466: -- for bug 7230256
467: l_count := 0;
468: select count (*) into l_count
469: from eam_pm_last_service
470: where meter_id=l_meter_id and ACTIVITY_ASSOCIATION_ID =l_last_act;
471:
472: if l_count = 0 then
473:
470: where meter_id=l_meter_id and ACTIVITY_ASSOCIATION_ID =l_last_act;
471:
472: if l_count = 0 then
473:
474: insert into eam_pm_last_service
475: ( METER_ID ,
476: ACTIVITY_ASSOCIATION_ID ,
477: LAST_SERVICE_READING ,
478: PREV_SERVICE_READING ,
2587: if (p_pm_schedule_rec.tmpl_flag is null or p_pm_schedule_rec.tmpl_flag='N') then -- FP: bug 9744000, added null condition
2588: while (p_pm_runtime_rules_tbl.exists(i)) loop
2589:
2590: select count(*) into l_count
2591: from eam_pm_last_service
2592: where meter_id=p_pm_runtime_rules_tbl(i).meter_id
2593: and activity_association_id=p_pm_activity_grp_rec.activity_association_id;
2594:
2595: if (l_count = 0) then
2593: and activity_association_id=p_pm_activity_grp_rec.activity_association_id;
2594:
2595: if (l_count = 0) then
2596:
2597: INSERT INTO eam_pm_last_service (activity_association_id, meter_id,
2598: last_service_reading, last_update_date, last_updated_by, creation_date,
2599: last_update_login, created_by)
2600: VALUES (p_pm_activity_grp_rec.activity_association_id,
2601: p_pm_runtime_rules_tbl(i).meter_id,
2692:
2693: end if;
2694:
2695: if l_lsi_updated = 'Y' then
2696: x_message := 'EAM_PM_LAST_SERVICE_DEFAULT';
2697: end if;
2698:
2699: return true;
2700:
3339:
3340: for runtime_rec in c_pm_runtime_rule loop
3341:
3342: select last_service_reading into lsr
3343: from eam_pm_last_service
3344: where meter_id = runtime_rec.meter_id and activity_association_id = l_act_assoc_id;
3345:
3346: update eam_pm_scheduling_rules set last_service_reading = lsr,
3347: last_update_date=sysdate,