Search Results v_entity_code




Overview

MTH_UDA_PKG is the core PL/SQL package body in the Oracle EBS application suite (APPS schema) that supports the MTH (Meter/Tag Historian) interface used for bulk uploading and staging of external attribute and meter data. Its central business function is to manage the transformation of staged attribute data (held in MTH_EXT_ATTR_T_STG) into a structure suitable for upload into the EBS database, including identification and enforcement of primary key metadata. The package resolves an entity code into the correct master table, its primary key column(s), and its extension tables, then uses dynamic SQL to update staged rows so that the primary key column name is properly populated. The header comment ("$Header: mthuntbb.pls 120.6.12010000.2") indicates this is a shipped, patched file maintained under the standard EBS versioning conventions. It is a utility package invoked by other packages rather than an end-user facing module.

Key Procedures and Functions

The package exposes sixteen documented procedures and functions. UPDATE_TO_PRIMARY_KEY populates the primary key column name for staged rows where DB_COL is null, validating that exactly one such row exists per GROUP_ID and raising application errors otherwise. NTB_UPLOAD, NTB_UPLOADTL, NTB_UPLOAD_STANDARD_WHO, NTB_UPLOAD_COMPOSITE_PK, and NTB_UPLOAD_COMPOSITETL are the upload drivers for standard and composite, single-language and translation (TL) attribute sets, and populate the standard "WHO" audit columns. TB_UPLOAD performs the base upload operation. DEVICE_PRE_LOG and DEVICE_POST_LOG bracket device-related processing with logging. GET_MST_TABLE_NAME, GET_MST_PK_NAME, GET_MST_COMPOSITE_PK_NAME, GET_EXT_TABLE_NAME, GET_EXT_TL_TABLE_NAME, and GET_ENTITY_CODE are accessor functions returning the resolved master table, primary key column, composite primary key, extension table, extension translation table, and entity code respectively. UPDATE_COMPOSITE_PRIMARY_KEY extends the primary key logic for composite keys. Note that the requester's search term v_entity_code corresponds to the local variable v_entity_code NUMBER declared inside UPDATE_TO_PRIMARY_KEY, a working variable used in that procedure's logic.

Tables Accessed

The package reads and writes MTH_EXT_ATTR_T_STG (the staging table for external attribute values, primary key and key metadata target), MTH_TAG_READINGS_T_STG (staging for tag/meter reading data), and MTH_RUN_LOG (the run/audit log table). It also references DUAL and PLITBLM (the PL/SQL table/bulk-collection support object), which are typical utility references within dynamic-SQL and set-based processing. Access to these base tables is made through APPS synonyms.

Usage Notes

MTH_UDA_PKG is not invoked directly through a form; it is referenced by two other packages and is designed to be called from upload batch routines and concurrent programs that process staged MTH data. The UPDATE_TO_PRIMARY_KEY routine must be run after attribute metadata and staging rows are loaded, because it validates that each GROUP_ID has exactly one row with DB_COL null (the primary key value) and raises -20001 (incorrect entity) or -20002 (data issue) errors when validation fails. Because it issues dynamic UPDATE statements via EXECUTE IMMEDIATE and commits, it should be invoked within the controlled upload/batch flow rather than interactively. When extending this package, developers should be aware that v_entity_code is only a local variable and that entity resolution depends on Get_Mst_Pk_Name.