Summary of the DBO.updateConnections Procedure
The DBO.updateConnections procedure is designed to efficiently refresh and update several key tables (connections, accesses, and connectionsLineIDs) in the database with new data. The procedure performs the following actions:
Initialization:
- Truncates the interim tables (
ACCESSENEW,CONNECTIONSNEW,CONNECTIONSLINEIDSNEW) to clear out any existing data.
- Truncates the interim tables (
Data Insertion:
- Inserts new data into the interim tables using complex SQL queries. These queries calculate fields such as connection IDs, monetary values, business unit IDs, and activity statuses, ensuring that only relevant and correctly calculated data is included.
External Circuit ID Integration:
- Merges data from the
EXTERNALCIRCUITIDtable intoCONNECTIONSNEWto add external circuit IDs where applicable.
- Merges data from the
Activity Status Updates:
- Updates the
ACC_ACTIVEstatus in theACCESSENEWtable to reflect the correct activity status based on current conditions, including handling active, inactive, and terminated lines.
- Updates the
Table Replacement:
- Uses the
DBMS_REDEFINITIONpackage to perform an in-place replacement of the original tables (connections,accesses, andconnectionsLineIDs) with their corresponding new tables (connectionsnew,accessesnew,connectionsLineIDsnew). This process is done without invalidating dependent PL/SQL objects, such as triggers, constraints, and indexes.
- Uses the
Finalization:
- Completes the update process by ensuring all dependent objects are correctly associated with the new tables and that all data is committed and the job is marked as complete.
This procedure is carefully designed to handle large volumes of data efficiently while ensuring the integrity and consistency of the database schema and its associated objects.
