Oracle HRMS – Delete Organization Classification and Organization Using API
📘 Overview
In Oracle HRMS, each organization is classified and stored in the HR_ALL_ORGANIZATION_UNITS and HR_ORGANIZATION_INFORMATION tables.
At times, system administrators or technical consultants may need to remove obsolete or test organization structures.
Oracle provides public APIs to safely perform these deletions:
-
HR_ORGANIZATION_API.DISABLE_ORG_CLASSIFICATION– disables and removes organization classifications. -
HR_ORGANIZATION_API.DELETE_ORGANIZATION– deletes the organization record itself.
The following scripts demonstrate how to use these APIs effectively with proper exception handling and output messages.
⚙️ Script 1: Delete Organization Classification
🔍 Explanation
-
Purpose: Removes all active classifications for a specific organization (e.g., 321).
-
Key Tables Used:
-
HR_ALL_ORGANIZATION_UNITS– master table for organizations. -
HR_ORGANIZATION_INFORMATION– stores classification and context details.
-
-
API Used:
-
DISABLE_ORG_CLASSIFICATIONremoves assigned classifications safely using API logic.
-
-
Parameters:
-
p_validate: If set toTRUE, only validates.FALSEactually deletes. -
p_effective_date: Date of deletion. -
p_org_information_id: Primary key for classification row. -
p_org_info_type_code: Type of classification (HR, Payroll, etc.). -
p_object_version_number: Ensures record version control.
-
⚙️ Script 2: Delete Organization
🔍 Explanation
-
Purpose: Deletes the organization itself from the system after all classifications are removed.
-
Key Table Used:
-
HR_ALL_ORGANIZATION_UNITS– main organization storage table.
-
-
API Used:
-
DELETE_ORGANIZATIONsafely deletes an organization along with related information.
-
-
Best Practice:
Always disable or delete all classifications before running this script to prevent referential constraint errors.
✅ Execution Steps
-
Login to Oracle database as APPS or an authorized schema user.
-
Enable DBMS Output in SQL Developer or TOAD.
-
Run the first script (
Delete_Organization_Classification.sql) to disable all classifications for the target organization ID. -
Run the second script (
Delete_Organization.sql) to delete the organization itself. -
Verify Results:
-
Query
HR_ALL_ORGANIZATION_UNITSto ensure the record is removed. -
Check
DBMS_OUTPUTmessages for confirmation or failure logs.
-
⚠️ Precautions
-
Always take a backup before performing deletions.
-
Perform deletions in a non-production environment first to validate dependencies.
-
Use correct
organization_idvalues — deletion is irreversible. -
If organizations are linked to other HR or Payroll data, you may need to remove dependent relationships first.
🧩 References
-
Oracle HRMS API Reference Guide
-
Table:
HR_ALL_ORGANIZATION_UNITS -
Table:
HR_ORGANIZATION_INFORMATION -
Package:
HR_ORGANIZATION_API
No comments:
Post a Comment