DECLARE
CURSOR stage
IS
SELECT *
FROM staging_meter_table
WHERE flag IS NULL ;
l_stat VARCHAR2 (10);
l_count NUMBER;
l_data VARCHAR2 (100);
l_meter_id NUMBER;
v_stat VARCHAR2 (1) := 'S';
BEGIN
FOR i IN stage
LOOP
eam_meter_pub.create_meter
(p_api_version => 1.0,
x_return_status => l_stat,
x_msg_count => l_count,
x_msg_data => l_data,
p_meter_name => i.meter_name,
p_meter_uom => i.meter_uom,
p_meter_type => i.meter_type,
p_value_change_dir => i.value_change_dir,
p_eam_required_flag => i.eam_required_flag,
p_used_in_scheduling => i.used_in_scheduling,
p_user_defined_rate => i.user_defined_rate,
p_use_past_reading => i.user_past_reading,
p_initial_reading => i.initial_reading,
p_description => i.description,
p_from_effective_date => i.from_effective_date,
p_initial_reading_date => i.initial_reading_date,
p_tmpl_flag => i.tmpl_flag,
x_new_meter_id => l_meter_id
);
UPDATE staging_meter_table
SET flag = l_stat,
data = substr(l_data,1,50)
WHERE meter_name = i.meter_name;
COMMIT;
END LOOP;
IF v_stat <> 'E'
THEN
COMMIT;
END IF;
END;
No comments:
Post a Comment