Search Results upd_or_sel




Overview

APPS.HR_CGD_UPD is a PL/SQL package body in the Oracle E-Business Suite Human Resources (HR) module. It belongs to the "CGD" family of packages (HR_CGD_SHD, HR_CGD_UPD, HR_CGD_INS, HR_CGD_DEL), which together implement the uniformly generated API pattern used throughout the HR schema for maintaining "Extra Information Types" (EIT) and related descriptive-flexfield data on the CGD entity. The CGD object corresponds to the "Grade/Competence Definition" (or comparable HR lookup/definition) style entity, backed by the standard WHO columns and descriptive-flex segment columns (SEGMENT1, SEGMENT2, ... ID_FLEX_NUM, SUMMARY_FLAG, ENABLED_FLAG, START_DATE_ACTIVE, END_DATE_ACTIVE).

The package's job is to accept a fully populated PL/SQL record of type hr_cgd_shd.g_rec_type and to persist updates to the underlying row, reconciling business defaults with the pre-existing values. The header comment ($Header: hrcgdrhi.pkb 115.4 2002/12/03 ...) shows the source is generated code shipped by Oracle, not customer-maintained logic, and it is therefore expected to be called only through the standard API layer, never modified in place. In the 12.1.1 and 12.2.2 releases the file retains the same generated structure, with G_PACKAGE holding the literal package name for instrumentation via hr_utility.set_location.

Key Procedures and Functions

  • CONVERT_DEFS — A private helper that inspects each field of the incoming p_rec record. Wherever a field still contains the API's sentinel "system default" value (hr_api.g_number, hr_api.g_varchar2 or hr_api.g_date), it is replaced with the corresponding value from the old record hr_cgd_shd.g_old_rec. This guarantees that a caller who supplies no value for a column does not overwrite the existing database value with NULL or a meaningless default; only explicitly supplied values survive. It is executed at the start of the update path.
  • UPD_OR_SEL — The public update entry point. It accepts a record of type hr_cgd_shd.g_rec_type together with the appropriate row identifier/primary key plus an object-version number, runs the convert_defs reconciliation, performs row-level locking/validation, and then issues the UPDATE against the CGD table. The name "UPD_OR_SEL" reflects the generated convention where the routine both updates the row and, on completion, returns ("selects") the resulting record so the caller sees the committed state. It is the procedure referenced when a user searches for "upd_or_sel" and is the only documented public routine in the body.

Tables Accessed

The ETRM metadata lists no directly referenced base tables through APPS synonyms, which is consistent with generated *_UPD packages that rely on private declarations and the shared package for the actual DML. In practice, the update path operates on the CGD entity table (the "CGD" flexfield-enabled definition table) and reads the previous row image held in hr_cgd_shd.g_old_rec. It depends on the shared package hr_cgd_shd for the record type, the old-record cache and helper constants. No insert or delete DML occurs here; those responsibilities belong to the sibling hr_cgd_ins and hr_cgd_del packages, keeping the generated API layer cleanly separated by operation.

Usage Notes

HR_CGD_UPD is normally invoked indirectly. Oracle Forms-based maintenance of the entity calls the API wrapper, which in turn dispatches to upd_or_sel; the same is true of concurrent programs that mass-maintain definitions, and of any custom PL/SQL that must update the entity under business-rule control. Because the package is documented as referenced by one other package, the safest integration point for custom code is the higher-level generated API rather than a direct call to upd_or_sel. When direct invocation is unavoidable, supply a record initialised from hr_cgd_shd.g_rec_type, set every column that must change, leave untouched columns at their API default sentinel so convert_defs preserves existing values, pass the current object version for optimistic locking, and commit explicitly. Do not edit the package body; it is a shipped, generated artifact and will be overwritten by patches.