DBA Data[Home] [Help]

APPS.MTH_SUSTAIN_ASPECT_PKG dependencies on MTH_TAG_METER_READINGS_LATEST

Line 311: * for a tag if table MTH_TAG_METER_READINGS_LATEST already *

307:
308: /* ****************************************************************************
309: * Procedure :upsert_tag_to_latest_tab *
310: * Description :Update the latest reading time and tag value *
311: * for a tag if table MTH_TAG_METER_READINGS_LATEST already *
312: * has a entry for the tag. Otherwise, insert a new row *
313: * File Name :MTHSUSAB.PLS *
314: * Visibility :Private *
315: * Parameters :p_tag_code - tag code *

Line 320: * MTH_TAG_METER_READINGS_LATEST or not *

316: * p_latest_reading_time - reading time of the latest *
317: * p_latest_tag_value - latest tag reading *
318: * p_lookup_entry_exist - whether the entry with the *
319: * same tag code exists in the *
320: * MTH_TAG_METER_READINGS_LATEST or not *
321: * Return Value :None *
322: **************************************************************************** */
323:
324: PROCEDURE upsert_tag_to_latest_tab(p_tag_code IN VARCHAR2,

Line 332: UPDATE MTH_TAG_METER_READINGS_LATEST

328: IS
329: BEGIN
330: -- If the entry exists, do the update; otherwise, do the insert
331: IF (p_lookup_entry_exist) THEN
332: UPDATE MTH_TAG_METER_READINGS_LATEST
333: SET reading_time = p_latest_reading_time, tag_value = p_latest_tag_value
334: WHERE tag_code = p_tag_code;
335: ELSE
336: INSERT INTO MTH_TAG_METER_READINGS_LATEST

Line 336: INSERT INTO MTH_TAG_METER_READINGS_LATEST

332: UPDATE MTH_TAG_METER_READINGS_LATEST
333: SET reading_time = p_latest_reading_time, tag_value = p_latest_tag_value
334: WHERE tag_code = p_tag_code;
335: ELSE
336: INSERT INTO MTH_TAG_METER_READINGS_LATEST
337: (TAG_CODE, READING_TIME, TAG_VALUE) VALUES
338: (p_tag_code, p_latest_reading_time, p_latest_tag_value);
339: END IF;
340:

Line 388: FROM MTH_TAG_METER_READINGS_LATEST

384:
385: -- Fetch the previous reading time for the given tag code
386: CURSOR c_getPrevReadingTimeForTag (p_tag_code IN VARCHAR2) IS
387: SELECT TAG_VALUE, READING_TIME
388: FROM MTH_TAG_METER_READINGS_LATEST
389: WHERE TAG_CODE = p_tag_code;
390:
391:
392: v_raw_tab_name VARCHAR2(30) := 'MTH_TAG_METER_READINGS_RAW';

Line 428: -- 2.0 Update/Create entry in MTH_TAG_METER_READINGS_LATEST for previous tag

424: -- 2. Fetch the raw data for active tag and process each row
425: FOR r_raw_data IN c_getRawData(v_curr_partition) LOOP
426: v_curr_tag_code := r_raw_data.TAG_CODE;
427:
428: -- 2.0 Update/Create entry in MTH_TAG_METER_READINGS_LATEST for previous tag
429: -- that is stored in v_last_... .
430: -- only if the there is no error or the timestamp is valid even though
431: -- there is an error in the preivoud set of values kept in v_last....
432: IF (v_last_tag_code IS NOT NULL AND v_last_tag_code <> v_curr_tag_code) THEN

Line 458: -- in the lookup table MTH_TAG_METER_READINGS_LATEST

454: FETCH c_getMetersForTag BULK COLLECT INTO v_meter_fk_key_array;
455: CLOSE c_getMetersForTag;
456:
457: -- 2.1.2 Find previous reading time and tag value for the currenttag
458: -- in the lookup table MTH_TAG_METER_READINGS_LATEST
459: OPEN c_getPrevReadingTimeForTag(v_curr_tag_code);
460: FETCH c_getPrevReadingTimeForTag INTO
461: v_prev_tag_value, v_prev_reading_time;
462: CLOSE c_getPrevReadingTimeForTag;

Line 519: -- - Save all of above into lookup table MTH_TAG_METER_READINGS_LATEST

515:
516: -- 2.4 Save the current data as previous data, which can be used for :
517: -- - Use the previous reading time - 1 second as FROM TIME for new data
518: -- - Use the previous tag value to calcuate the incremental value
519: -- - Save all of above into lookup table MTH_TAG_METER_READINGS_LATEST
520: -- when processing the last reading for this tag, wihch can be
521: -- identified by find the next and different tag code
522: IF (v_err_code IS NULL OR Length(v_err_code) = 0) or
523: Length(v_err_code) > 0 and v_is_valid_timestamp THEN

Line 539: -- 2.6 Update/Create entry in MTH_TAG_METER_READINGS_LATEST for the last tag.

535: END IF;
536:
537: END LOOP;
538:
539: -- 2.6 Update/Create entry in MTH_TAG_METER_READINGS_LATEST for the last tag.
540: -- Since we have kept the information for the last reading, just
541: -- need to make sure that v_last_tag_code exists.
542: IF (v_last_tag_code is not NULL) THEN
543: upsert_tag_to_latest_tab(v_last_tag_code,

Line 2332: mth_util_pkg.mth_truncate_table('MTH_TAG_METER_READINGS_LATEST');

2328: **************************************************************************** */
2329: PROCEDURE truncate_entity_sustain_data
2330: IS
2331: BEGIN
2332: mth_util_pkg.mth_truncate_table('MTH_TAG_METER_READINGS_LATEST');
2333: mth_util_pkg.mth_truncate_table('MTH_METER_READINGS');
2334: mth_util_pkg.mth_truncate_table('MTH_METER_READINGS_ERR');
2335: mth_util_pkg.mth_truncate_table('MTH_ENTITY_SUST_EMISSIONS');
2336: mth_util_pkg.mth_truncate_table('MTH_ENTITY_SUSTAIN_ASPECT');