[Home] [Help]
PACKAGE BODY: APPS.GCS_LEX_MAP_STRUCTS_PKG
Source
1 PACKAGE BODY GCS_LEX_MAP_STRUCTS_PKG AS
2 /* $Header: gcslxmsb.pls 115.2 2003/08/13 17:54:49 mikeward noship $ */
3 --
4 -- Package
5 -- gcs_lex_map_structs_pkg
6 -- Purpose
7 -- Package procedures for Lexical Mapping Structures
8 -- History
9 -- 23-JUN-03 M Ward Created
10 -- 28-JUL-03 M Ward Added translate_row
11 --
12
13 PROCEDURE Insert_Row( row_id IN OUT NOCOPY VARCHAR2,
14 structure_name VARCHAR2,
15 description VARCHAR2,
16 table_use_type_code VARCHAR2,
17 last_update_date DATE,
18 last_updated_by NUMBER,
19 last_update_login NUMBER,
20 creation_date DATE,
21 created_by NUMBER) IS
22 CURSOR struct_row IS
23 SELECT rowid
24 FROM gcs_lex_map_structs ms
25 WHERE ms.structure_name = insert_row.structure_name;
26 BEGIN
27 IF structure_name IS NULL THEN
28 raise no_data_found;
29 END IF;
30
31 INSERT INTO gcs_lex_map_structs( structure_id,
32 structure_name,
33 description,
34 table_use_type_code,
35 last_update_date,
36 last_updated_by,
37 last_update_login,
38 creation_date,
39 created_by)
40 SELECT gcs_lex_map_structs_s.nextval,
41 structure_name,
42 description,
43 table_use_type_code,
44 last_update_date,
45 last_updated_by,
46 last_update_login,
47 creation_date,
48 created_by
49 FROM dual
50 WHERE NOT EXISTS
51 (SELECT 1
52 FROM gcs_lex_map_structs ms
53 WHERE ms.structure_name = insert_row.structure_name);
54
55 OPEN struct_row;
56 FETCH struct_row INTO row_id;
57 IF struct_row%NOTFOUND THEN
58 CLOSE struct_row;
59 raise no_data_found;
60 END IF;
61 CLOSE struct_row;
62 END Insert_Row;
63
64 PROCEDURE Update_Row( structure_name VARCHAR2,
65 description VARCHAR2,
66 table_use_type_code VARCHAR2,
67 last_update_date DATE,
68 last_updated_by NUMBER,
69 last_update_login NUMBER) IS
70 BEGIN
71 UPDATE gcs_lex_map_structs ms
72 SET description = update_row.description,
73 table_use_type_code = update_row.table_use_type_code,
74 last_update_date = update_row.last_update_date,
75 last_updated_by = update_row.last_updated_by,
76 last_update_login = update_row.last_update_login
77 WHERE ms.structure_name = update_row.structure_name;
78
79 IF SQL%NOTFOUND THEN
80 raise no_data_found;
81 END IF;
82 END Update_Row;
83
84 PROCEDURE Load_Row( structure_name VARCHAR2,
85 owner VARCHAR2,
86 last_update_date VARCHAR2,
87 description VARCHAR2,
88 table_use_type_code VARCHAR2,
89 custom_mode VARCHAR2) IS
90 row_id VARCHAR2(64);
91 f_luby NUMBER; -- entity owner in file
92 f_ludate DATE; -- entity update date in file
93 db_luby NUMBER; -- entity owner in db
94 db_ludate DATE; -- entity update date in db
95 BEGIN
96 -- Get last updated information from the loader data file
97 f_luby := fnd_load_util.owner_id(owner);
98 f_ludate := nvl(to_date(last_update_date, 'YYYY/MM/DD'), sysdate);
99
100 BEGIN
101 SELECT ms.last_updated_by, ms.last_update_date
102 INTO db_luby, db_ludate
103 FROM GCS_LEX_MAP_STRUCTS ms
104 WHERE ms.structure_name = load_row.structure_name;
105
106 -- Test for customization information
107 IF fnd_load_util.upload_test(f_luby, f_ludate, db_luby, db_ludate,
108 custom_mode) THEN
109 update_row( structure_name => structure_name,
110 description => description,
111 table_use_type_code => table_use_type_code,
112 last_update_date => f_ludate,
113 last_updated_by => f_luby,
114 last_update_login => 0);
115 END IF;
116 EXCEPTION
117 WHEN NO_DATA_FOUND THEN
118 insert_row( row_id => row_id,
119 structure_name => structure_name,
120 description => description,
121 table_use_type_code => table_use_type_code,
122 last_update_date => f_ludate,
123 last_updated_by => f_luby,
124 last_update_login => 0,
125 creation_date => f_ludate,
126 created_by => f_luby);
127 END;
128 END Load_Row;
129
130 PROCEDURE Translate_Row( structure_name VARCHAR2,
131 owner VARCHAR2,
132 last_update_date VARCHAR2,
133 custom_mode VARCHAR2) IS
134 f_luby NUMBER; -- entity owner in file
135 f_ludate DATE; -- entity update date in file
136 db_luby NUMBER; -- entity owner in db
137 db_ludate DATE; -- entity update date in db
138 BEGIN
139 -- Get last updated information from the loader data file
140 f_luby := fnd_load_util.owner_id(owner);
141 f_ludate := nvl(to_date(last_update_date, 'YYYY/MM/DD'), sysdate);
142
143 BEGIN
144 SELECT ms.last_updated_by, ms.last_update_date
145 INTO db_luby, db_ludate
146 FROM GCS_LEX_MAP_STRUCTS ms
147 WHERE ms.structure_name = translate_row.structure_name;
148
149 -- Test for customization information
150 IF fnd_load_util.upload_test(f_luby, f_ludate, db_luby, db_ludate,
151 custom_mode) THEN
152 UPDATE gcs_lex_map_structs ms
153 SET last_update_date = f_ludate,
154 last_updated_by = f_luby,
155 last_update_login = 0
156 WHERE ms.structure_name = translate_row.structure_name;
157 END IF;
158 EXCEPTION
159 WHEN NO_DATA_FOUND THEN
160 null;
161 END;
162 END Translate_Row;
163
164 END GCS_LEX_MAP_STRUCTS_PKG;