1: package body MSD_HIERARCHIES_PKG as
2: /* $Header: msdhpkgb.pls 120.0 2005/05/25 20:40:47 appldev noship $ */
3: PROCEDURE LOAD_ROW(
4: X_HIERARCHY_ID varchar2,
5: X_PLAN_TYPE varchar2,--- Added to include PLAN_TYPE
44:
45: begin
46: select LAST_UPDATED_BY, LAST_UPDATE_DATE
47: into db_luby, db_ludate
48: from MSD_HIERARCHIES
49: where HIERARCHY_ID = to_number(x_HIERARCHY_id)
50: and nvl(plan_type,-1) = nvl(to_char(x_plan_type),-1) ;
51:
52: -- Update record, honoring customization mode.
57: if ((x_custom_mode = 'FORCE') or
58: ((f_luby = 0) and (db_luby = 1)) or
59: ((f_luby = db_luby) and (f_ludate > db_ludate)))
60: then
61: update MSD_HIERARCHIES set
62: HIERARCHY_NAME = X_HIERARCHY_NAME,
63: DESCRIPTION = X_DESCRIPTION,
64: DIMENSION_CODE = X_DIMENSION_CODE,
65: VALID_FLAG = to_number(X_VALID_FLAG),
87: end if;
88: exception
89: when no_data_found then
90: -- Record doesn't exist - insert in all cases
91: insert into MSD_HIERARCHIES (
92: HIERARCHY_ID,
93: PLAN_TYPE,
94: HIERARCHY_NAME,
95: DESCRIPTION,
181: --
182: begin
183: select LAST_UPDATED_BY, LAST_UPDATE_DATE
184: into db_luby, db_ludate
185: from MSD_HIERARCHIES
186: where HIERARCHY_id = to_number(x_HIERARCHY_id) and
187: nvl(plan_type,-1) =nvl( to_char(x_plan_type),-1) ;
188:
189: -- Update record, honoring customization mode.
194: if ((x_custom_mode = 'FORCE') or
195: ((f_luby = 0) and (db_luby = 1)) or
196: ((f_luby = db_luby) and (f_ludate > db_ludate)))
197: then
198: update MSD_HIERARCHIES
199: set
200: HIERARCHY_name = nvl(x_HIERARCHY_name, HIERARCHY_name),
201: DESCRIPTION = nvl(x_description, DESCRIPTION),
202: LAST_UPDATE_DATE = f_ludate,
394: /* get bottom level */
395: begin
396: select l.level_id
397: into lvl
398: from msd_levels l, msd_hierarchies h
399: where h.hierarchy_id = hid
400: and l.dimension_code = h.dimension_code
401: and l.level_type_code = 2
402: and nvl(h.plan_type,-1) = nvl( p_plan_type,-1)
440: end loop;
441:
442: end is_hierarchy_complete;
443:
444: end MSD_HIERARCHIES_PKG;