DBA Data[Home] [Help]

PACKAGE BODY: APPS.AMS_TRIGGER_PKG

Source


1 PACKAGE BODY AMS_TRIGGER_PKG as
2 /* $Header: amsttrgb.pls 115.2 2002/11/16 01:45:03 dbiswas ship $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 --      AMS_TRIGGER_PKG
7 -- Purpose
8 --      Table api for triggers.
9 -- History
10 --      16-apr-2002    soagrawa     Created
11 --      16-apr-2002    soagrawa     Added add_language for bug# 2323843
12 --      12-jun-2002    soagrawa     Added insert_row, update_row, delete_row, lock_row
13 -- NOTE
14 --
15 -- End of Comments
16 -- ===============================================================
17 
18 
19 G_PKG_NAME CONSTANT VARCHAR2(30):= 'AMS_TRIGGER_PKG';
20 G_FILE_NAME CONSTANT VARCHAR2(12) := 'amsttrgb.pls';
21 
22 
23 
24 
25  --  ========================================================
26  --
27  --  NAME
28  --      Insert_Row
29  --
30  --  PURPOSE
31  --
32  --  NOTES
33  --
34  --  HISTORY
35 --      16-apr-2002    soagrawa     Created
36  --  ========================================================
37 
38  PROCEDURE Insert_Row(
39            px_trigger_id   IN OUT NOCOPY NUMBER,
40            p_last_update_date    DATE,
41            p_last_updated_by    NUMBER,
42            p_creation_date    DATE,
43            p_created_by    NUMBER,
44            p_last_update_login    NUMBER,
45            px_object_version_number   IN OUT NOCOPY NUMBER,
46            p_process_id    NUMBER,
47            p_trigger_created_for_id    NUMBER,
48            p_arc_trigger_created_for    VARCHAR2,
49            p_triggering_type    VARCHAR2,
50            p_trigger_name    VARCHAR2,
51            p_view_application_id    NUMBER,
52            p_start_date_time    DATE,
53            p_last_run_date_time    DATE,
54            p_next_run_date_time    DATE,
55            p_repeat_daily_start_time    DATE,
56            p_repeat_daily_end_time    DATE,
57            p_repeat_frequency_type    VARCHAR2,
58            p_repeat_every_x_frequency    NUMBER,
59            p_repeat_stop_date_time    DATE,
60            p_metrics_refresh_type    VARCHAR2,
61            p_description    VARCHAR2,
62            p_timezone_id    NUMBER,
63            p_user_start_date_time    DATE,
64            p_user_last_run_date_time    DATE,
65            p_user_next_run_date_time    DATE,
66            p_user_repeat_daily_start_time    DATE,
67            p_user_repeat_daily_end_time    DATE,
68            p_user_repeat_stop_date_time    DATE,
69            p_security_group_id    NUMBER)
70 
71   IS
72     x_rowid    VARCHAR2(30);
73 
74 
75  BEGIN
76 
77 
78     px_object_version_number := 1;
79 
80 
81     INSERT INTO AMS_TRIGGERS(
82             trigger_id,
83             last_update_date,
84             last_updated_by,
85             creation_date,
86             created_by,
87             last_update_login,
88             object_version_number,
89             process_id,
90             trigger_created_for_id,
91             arc_trigger_created_for,
92             triggering_type,
93             trigger_name,
94             view_application_id,
95             start_date_time,
96             last_run_date_time,
97             next_run_date_time,
98             repeat_daily_start_time,
99             repeat_daily_end_time,
100             repeat_frequency_type,
101             repeat_every_x_frequency,
102             repeat_stop_date_time,
103             metrics_refresh_type,
104             description,
105            timezone_id,
106             user_start_date_time,
107             user_last_run_date_time,
108             user_next_run_date_time,
109             user_repeat_daily_start_time,
110             user_repeat_daily_end_time,
111             user_repeat_stop_date_time,
112             security_group_id
113     ) VALUES (
114             DECODE( px_trigger_id, FND_API.g_miss_num, NULL, px_trigger_id),
115             DECODE( p_last_update_date, FND_API.g_miss_date, NULL, p_last_update_date),
116             DECODE( p_last_updated_by, FND_API.g_miss_num, NULL, p_last_updated_by),
117             DECODE( p_creation_date, FND_API.g_miss_date, NULL, p_creation_date),
118             DECODE( p_created_by, FND_API.g_miss_num, NULL, p_created_by),
119             DECODE( p_last_update_login, FND_API.g_miss_num, NULL, p_last_update_login),
120             DECODE( px_object_version_number, FND_API.g_miss_num, NULL, px_object_version_number),
121             DECODE( p_process_id, FND_API.g_miss_num, NULL, p_process_id),
122             DECODE( p_trigger_created_for_id, FND_API.g_miss_num, NULL, p_trigger_created_for_id),
123             DECODE( p_arc_trigger_created_for, FND_API.g_miss_char, NULL, p_arc_trigger_created_for),
124             DECODE( p_triggering_type, FND_API.g_miss_char, NULL, p_triggering_type),
125             DECODE( p_trigger_name, FND_API.g_miss_char, NULL, p_trigger_name),
126             DECODE( p_view_application_id, FND_API.g_miss_num, NULL, p_view_application_id),
127             DECODE( p_start_date_time, FND_API.g_miss_date, NULL, p_start_date_time),
128             DECODE( p_last_run_date_time, FND_API.g_miss_date, NULL, p_last_run_date_time),
129             DECODE( p_next_run_date_time, FND_API.g_miss_date, NULL, p_next_run_date_time),
130             DECODE( p_repeat_daily_start_time, FND_API.g_miss_date, NULL, p_repeat_daily_start_time),
131             DECODE( p_repeat_daily_end_time, FND_API.g_miss_date, NULL, p_repeat_daily_end_time),
132             DECODE( p_repeat_frequency_type, FND_API.g_miss_char, NULL, p_repeat_frequency_type),
133             DECODE( p_repeat_every_x_frequency, FND_API.g_miss_num, NULL, p_repeat_every_x_frequency),
134             DECODE( p_repeat_stop_date_time, FND_API.g_miss_date, NULL, p_repeat_stop_date_time),
135             DECODE( p_metrics_refresh_type, FND_API.g_miss_char, NULL, p_metrics_refresh_type),
136             DECODE( p_description, FND_API.g_miss_char, NULL, p_description),
137             DECODE( p_timezone_id, FND_API.g_miss_num, NULL, p_timezone_id),
138             DECODE( p_user_start_date_time, FND_API.g_miss_date, NULL, p_user_start_date_time),
139             DECODE( p_user_last_run_date_time, FND_API.g_miss_date, NULL, p_user_last_run_date_time),
140             DECODE( p_user_next_run_date_time, FND_API.g_miss_date, NULL, p_user_next_run_date_time),
141             DECODE( p_user_repeat_daily_start_time, FND_API.g_miss_date, NULL, p_user_repeat_daily_start_time),
142             DECODE( p_user_repeat_daily_end_time, FND_API.g_miss_date, NULL, p_user_repeat_daily_end_time),
143             DECODE( p_user_repeat_stop_date_time, FND_API.g_miss_date, NULL, p_user_repeat_stop_date_time),
144             DECODE( p_security_group_id, FND_API.g_miss_num, NULL, p_security_group_id));
145  END Insert_Row;
146 
147 
148 
149  --  ========================================================
150  --
151  --  NAME
152  --      Update_Row
153  --
154  --  PURPOSE
155  --
156  --  NOTES
157  --
158  --  HISTORY
159 --      16-apr-2002    soagrawa     Created
160  --  ========================================================
161 
162  PROCEDURE Update_Row(
163            p_trigger_id    NUMBER,
164            p_last_update_date    DATE,
165            p_last_updated_by    NUMBER,
166            p_creation_date    DATE,
167            p_created_by    NUMBER,
168            p_last_update_login    NUMBER,
169            p_object_version_number    NUMBER,
170            p_process_id    NUMBER,
171            p_trigger_created_for_id    NUMBER,
172            p_arc_trigger_created_for    VARCHAR2,
173            p_triggering_type    VARCHAR2,
174            p_trigger_name    VARCHAR2,
175            p_view_application_id    NUMBER,
176            p_start_date_time    DATE,
177            p_last_run_date_time    DATE,
178            p_next_run_date_time    DATE,
179            p_repeat_daily_start_time    DATE,
180            p_repeat_daily_end_time    DATE,
181            p_repeat_frequency_type    VARCHAR2,
182            p_repeat_every_x_frequency    NUMBER,
183            p_repeat_stop_date_time    DATE,
184            p_metrics_refresh_type    VARCHAR2,
185            p_description    VARCHAR2,
186            p_timezone_id    NUMBER,
187            p_user_start_date_time    DATE,
188            p_user_last_run_date_time    DATE,
189            p_user_next_run_date_time    DATE,
190            p_user_repeat_daily_start_time    DATE,
191            p_user_repeat_daily_end_time    DATE,
192            p_user_repeat_stop_date_time    DATE,
193            p_security_group_id    NUMBER)
194 
195   IS
196   BEGIN
197      Update AMS_TRIGGERS
198      SET
199                trigger_id = DECODE( p_trigger_id, FND_API.g_miss_num, trigger_id, p_trigger_id),
200                last_update_date = DECODE( p_last_update_date, FND_API.g_miss_date, last_update_date, p_last_update_date),
201                last_updated_by = DECODE( p_last_updated_by, FND_API.g_miss_num, last_updated_by, p_last_updated_by),
202                creation_date = DECODE( p_creation_date, FND_API.g_miss_date, creation_date, p_creation_date),
203                created_by = DECODE( p_created_by, FND_API.g_miss_num, created_by, p_created_by),
204                last_update_login = DECODE( p_last_update_login, FND_API.g_miss_num, last_update_login, p_last_update_login),
205                object_version_number = DECODE( p_object_version_number, FND_API.g_miss_num, object_version_number, p_object_version_number),
206                process_id = DECODE( p_process_id, FND_API.g_miss_num, process_id, p_process_id),
207                trigger_created_for_id = DECODE( p_trigger_created_for_id, FND_API.g_miss_num, trigger_created_for_id, p_trigger_created_for_id),
208                arc_trigger_created_for = DECODE( p_arc_trigger_created_for, FND_API.g_miss_char, arc_trigger_created_for, p_arc_trigger_created_for),
209                triggering_type = DECODE( p_triggering_type, FND_API.g_miss_char, triggering_type, p_triggering_type),
210                trigger_name = DECODE( p_trigger_name, FND_API.g_miss_char, trigger_name, p_trigger_name),
211                view_application_id = DECODE( p_view_application_id, FND_API.g_miss_num, view_application_id, p_view_application_id),
212                start_date_time = DECODE( p_start_date_time, FND_API.g_miss_date, start_date_time, p_start_date_time),
213                last_run_date_time = DECODE( p_last_run_date_time, FND_API.g_miss_date, last_run_date_time, p_last_run_date_time),
214                next_run_date_time = DECODE( p_next_run_date_time, FND_API.g_miss_date, next_run_date_time, p_next_run_date_time),
215                repeat_daily_start_time = DECODE( p_repeat_daily_start_time, FND_API.g_miss_date, repeat_daily_start_time, p_repeat_daily_start_time),
216                repeat_daily_end_time = DECODE( p_repeat_daily_end_time, FND_API.g_miss_date, repeat_daily_end_time, p_repeat_daily_end_time),
217                repeat_frequency_type = DECODE( p_repeat_frequency_type, FND_API.g_miss_char, repeat_frequency_type, p_repeat_frequency_type),
218                repeat_every_x_frequency = DECODE( p_repeat_every_x_frequency, FND_API.g_miss_num, repeat_every_x_frequency, p_repeat_every_x_frequency),
219                repeat_stop_date_time = DECODE( p_repeat_stop_date_time, FND_API.g_miss_date, repeat_stop_date_time, p_repeat_stop_date_time),
220                metrics_refresh_type = DECODE( p_metrics_refresh_type, FND_API.g_miss_char, metrics_refresh_type, p_metrics_refresh_type),
221                description = DECODE( p_description, FND_API.g_miss_char, description, p_description),
222                timezone_id = DECODE( p_timezone_id, FND_API.g_miss_num, timezone_id, p_timezone_id),
223                user_start_date_time = DECODE( p_user_start_date_time, FND_API.g_miss_date, user_start_date_time, p_user_start_date_time),
224                user_last_run_date_time = DECODE( p_user_last_run_date_time, FND_API.g_miss_date, user_last_run_date_time, p_user_last_run_date_time),
225                user_next_run_date_time = DECODE( p_user_next_run_date_time, FND_API.g_miss_date, user_next_run_date_time, p_user_next_run_date_time),
226                user_repeat_daily_start_time = DECODE( p_user_repeat_daily_start_time, FND_API.g_miss_date, user_repeat_daily_start_time, p_user_repeat_daily_start_time),
227                user_repeat_daily_end_time = DECODE( p_user_repeat_daily_end_time, FND_API.g_miss_date, user_repeat_daily_end_time, p_user_repeat_daily_end_time),
228                user_repeat_stop_date_time = DECODE( p_user_repeat_stop_date_time, FND_API.g_miss_date, user_repeat_stop_date_time, p_user_repeat_stop_date_time),
229                security_group_id = DECODE( p_security_group_id, FND_API.g_miss_num, security_group_id, p_security_group_id)
230     WHERE TRIGGER_ID = p_TRIGGER_ID
231     AND   object_version_number = p_object_version_number;
232 
233     IF (SQL%NOTFOUND) THEN
234  RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
235     END IF;
236  END Update_Row;
237 
238 
239 
240  --  ========================================================
241  --
242  --  NAME
243  --      Delete_Row
244  --
245  --  PURPOSE
246  --
247  --  NOTES
248  --
249  --  HISTORY
250 --      16-apr-2002    soagrawa     Created
251  --  ========================================================
252 
253  PROCEDURE Delete_Row(
254      p_TRIGGER_ID  NUMBER)
255   IS
256   BEGIN
257     DELETE FROM AMS_TRIGGERS
258      WHERE TRIGGER_ID = p_TRIGGER_ID;
259     If (SQL%NOTFOUND) then
260  RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
261     End If;
262   END Delete_Row ;
263 
264 
265 
266 
267  --  ========================================================
268  --
269  --  NAME
270  --      Lock_Row
271  --
272  --  PURPOSE
273  --
274  --  NOTES
275  --
276  --  HISTORY
277 --      16-apr-2002    soagrawa     Created
278  --  ========================================================
279 
280 
281  PROCEDURE Lock_Row(
282            p_trigger_id    NUMBER,
283            p_last_update_date    DATE,
284            p_last_updated_by    NUMBER,
285            p_creation_date    DATE,
286            p_created_by    NUMBER,
287            p_last_update_login    NUMBER,
288            p_object_version_number    NUMBER,
289            p_process_id    NUMBER,
290            p_trigger_created_for_id    NUMBER,
291            p_arc_trigger_created_for    VARCHAR2,
292            p_triggering_type    VARCHAR2,
293            p_trigger_name    VARCHAR2,
294            p_view_application_id    NUMBER,
295            p_start_date_time    DATE,
296            p_last_run_date_time    DATE,
297            p_next_run_date_time    DATE,
298            p_repeat_daily_start_time    DATE,
299            p_repeat_daily_end_time    DATE,
300            p_repeat_frequency_type    VARCHAR2,
301            p_repeat_every_x_frequency    NUMBER,
302            p_repeat_stop_date_time    DATE,
303            p_metrics_refresh_type    VARCHAR2,
304            p_description    VARCHAR2,
305            p_timezone_id    NUMBER,
306            p_user_start_date_time    DATE,
307            p_user_last_run_date_time    DATE,
311            p_user_repeat_stop_date_time    DATE,
308            p_user_next_run_date_time    DATE,
309            p_user_repeat_daily_start_time    DATE,
310            p_user_repeat_daily_end_time    DATE,
312            p_security_group_id    NUMBER)
313 
314   IS
315     CURSOR C IS
316          SELECT *
317           FROM AMS_TRIGGERS
318          WHERE TRIGGER_ID =  p_TRIGGER_ID
319          FOR UPDATE of TRIGGER_ID NOWAIT;
320     Recinfo C%ROWTYPE;
321   BEGIN
322      OPEN c;
323      FETCH c INTO Recinfo;
324      If (c%NOTFOUND) then
325          CLOSE c;
326          FND_MESSAGE.SET_NAME('FND', 'FORM_RECORD_DELETED');
327          APP_EXCEPTION.RAISE_EXCEPTION;
328      END IF;
329      CLOSE C;
330      IF (
331             (      Recinfo.trigger_id = p_trigger_id)
332         AND (    ( Recinfo.last_update_date = p_last_update_date)
333              OR (    ( Recinfo.last_update_date IS NULL )
334                  AND (  p_last_update_date IS NULL )))
335         AND (    ( Recinfo.last_updated_by = p_last_updated_by)
336              OR (    ( Recinfo.last_updated_by IS NULL )
337                  AND (  p_last_updated_by IS NULL )))
338         AND (    ( Recinfo.creation_date = p_creation_date)
339              OR (    ( Recinfo.creation_date IS NULL )
340                  AND (  p_creation_date IS NULL )))
341         AND (    ( Recinfo.created_by = p_created_by)
342              OR (    ( Recinfo.created_by IS NULL )
343                  AND (  p_created_by IS NULL )))
344         AND (    ( Recinfo.last_update_login = p_last_update_login)
345              OR (    ( Recinfo.last_update_login IS NULL )
346                  AND (  p_last_update_login IS NULL )))
347         AND (    ( Recinfo.object_version_number = p_object_version_number)
348              OR (    ( Recinfo.object_version_number IS NULL )
349                  AND (  p_object_version_number IS NULL )))
350         AND (    ( Recinfo.process_id = p_process_id)
351              OR (    ( Recinfo.process_id IS NULL )
352                  AND (  p_process_id IS NULL )))
353         AND (    ( Recinfo.trigger_created_for_id = p_trigger_created_for_id)
354              OR (    ( Recinfo.trigger_created_for_id IS NULL )
355                  AND (  p_trigger_created_for_id IS NULL )))
356         AND (    ( Recinfo.arc_trigger_created_for = p_arc_trigger_created_for)
357              OR (    ( Recinfo.arc_trigger_created_for IS NULL )
358                  AND (  p_arc_trigger_created_for IS NULL )))
359         AND (    ( Recinfo.triggering_type = p_triggering_type)
360              OR (    ( Recinfo.triggering_type IS NULL )
361                  AND (  p_triggering_type IS NULL )))
362         AND (    ( Recinfo.trigger_name = p_trigger_name)
363              OR (    ( Recinfo.trigger_name IS NULL )
364                  AND (  p_trigger_name IS NULL )))
365         AND (    ( Recinfo.view_application_id = p_view_application_id)
366              OR (    ( Recinfo.view_application_id IS NULL )
367                  AND (  p_view_application_id IS NULL )))
368         AND (    ( Recinfo.start_date_time = p_start_date_time)
369              OR (    ( Recinfo.start_date_time IS NULL )
370                  AND (  p_start_date_time IS NULL )))
371         AND (    ( Recinfo.last_run_date_time = p_last_run_date_time)
372              OR (    ( Recinfo.last_run_date_time IS NULL )
373                  AND (  p_last_run_date_time IS NULL )))
374         AND (    ( Recinfo.next_run_date_time = p_next_run_date_time)
375              OR (    ( Recinfo.next_run_date_time IS NULL )
376                  AND (  p_next_run_date_time IS NULL )))
377         AND (    ( Recinfo.repeat_daily_start_time = p_repeat_daily_start_time)
378              OR (    ( Recinfo.repeat_daily_start_time IS NULL )
379                  AND (  p_repeat_daily_start_time IS NULL )))
380         AND (    ( Recinfo.repeat_daily_end_time = p_repeat_daily_end_time)
381              OR (    ( Recinfo.repeat_daily_end_time IS NULL )
382                  AND (  p_repeat_daily_end_time IS NULL )))
383         AND (    ( Recinfo.repeat_frequency_type = p_repeat_frequency_type)
384              OR (    ( Recinfo.repeat_frequency_type IS NULL )
385                  AND (  p_repeat_frequency_type IS NULL )))
386         AND (    ( Recinfo.repeat_every_x_frequency = p_repeat_every_x_frequency)
387              OR (    ( Recinfo.repeat_every_x_frequency IS NULL )
388                  AND (  p_repeat_every_x_frequency IS NULL )))
389         AND (    ( Recinfo.repeat_stop_date_time = p_repeat_stop_date_time)
390              OR (    ( Recinfo.repeat_stop_date_time IS NULL )
391                  AND (  p_repeat_stop_date_time IS NULL )))
392         AND (    ( Recinfo.metrics_refresh_type = p_metrics_refresh_type)
393              OR (    ( Recinfo.metrics_refresh_type IS NULL )
394                  AND (  p_metrics_refresh_type IS NULL )))
395         AND (    ( Recinfo.description = p_description)
396              OR (    ( Recinfo.description IS NULL )
397                  AND (  p_description IS NULL )))
398         AND (    ( Recinfo.timezone_id = p_timezone_id)
399              OR (    ( Recinfo.timezone_id IS NULL )
400                  AND (  p_timezone_id IS NULL )))
401         AND (    ( Recinfo.user_start_date_time = p_user_start_date_time)
402              OR (    ( Recinfo.user_start_date_time IS NULL )
403                  AND (  p_user_start_date_time IS NULL )))
404         AND (    ( Recinfo.user_last_run_date_time = p_user_last_run_date_time)
405              OR (    ( Recinfo.user_last_run_date_time IS NULL )
406                  AND (  p_user_last_run_date_time IS NULL )))
410         AND (    ( Recinfo.user_repeat_daily_start_time = p_user_repeat_daily_start_time)
407         AND (    ( Recinfo.user_next_run_date_time = p_user_next_run_date_time)
408              OR (    ( Recinfo.user_next_run_date_time IS NULL )
409                  AND (  p_user_next_run_date_time IS NULL )))
411              OR (    ( Recinfo.user_repeat_daily_start_time IS NULL )
412                  AND (  p_user_repeat_daily_start_time IS NULL )))
413         AND (    ( Recinfo.user_repeat_daily_end_time = p_user_repeat_daily_end_time)
414              OR (    ( Recinfo.user_repeat_daily_end_time IS NULL )
415                  AND (  p_user_repeat_daily_end_time IS NULL )))
416         AND (    ( Recinfo.user_repeat_stop_date_time = p_user_repeat_stop_date_time)
417              OR (    ( Recinfo.user_repeat_stop_date_time IS NULL )
418                  AND (  p_user_repeat_stop_date_time IS NULL )))
419         AND (    ( Recinfo.security_group_id = p_security_group_id)
420              OR (    ( Recinfo.security_group_id IS NULL )
421                  AND (  p_security_group_id IS NULL )))
422         ) THEN
423         RETURN;
424     ELSE
425         FND_MESSAGE.SET_NAME('FND', 'FORM_RECORD_CHANGED');
426         APP_EXCEPTION.RAISE_EXCEPTION;
427     END IF;
428  END Lock_Row;
429 
430 
431 
432 -- ===============================================================
433 -- Start of Comments
434 -- Procedure name
435 --      ADD_LANGUAGE
436 -- Purpose
437 --
438 -- History
439 --      16-apr-2002    soagrawa     Created. Refer to bug# 2323843.
440 -- NOTE
441 --
442 -- End of Comments
443 -- ===============================================================
444 
445 
446 
447 procedure ADD_LANGUAGE
448 is
449 begin
450   delete from ams_triggers_tl T
451   where not exists
452     (select NULL
453     from ams_triggers B
454     where B.trigger_id = T.trigger_id
455     );
456 
457   update ams_triggers_tl T set (
458       trigger_name
459       , DESCRIPTION
460     ) = (select
461       B.trigger_name
462       , B.DESCRIPTION
463     from ams_triggers_tl B
464     where B.trigger_id = T.trigger_id
465     and B.LANGUAGE = T.SOURCE_LANG)
466   where (
467       T.trigger_id,
468       T.LANGUAGE
469   ) in (select
470       SUBT.trigger_id,
471       SUBT.LANGUAGE
472     from ams_triggers_tl SUBB, ams_triggers_tl SUBT
473     where SUBB.trigger_id = SUBT.trigger_id
474     and SUBB.LANGUAGE = SUBT.SOURCE_LANG
475     and (SUBB.trigger_name <> SUBT.trigger_name
476       or SUBB.DESCRIPTION <> SUBT.DESCRIPTION
477       or (SUBB.DESCRIPTION is null and SUBT.DESCRIPTION is not null)
478       or (SUBB.DESCRIPTION is not null and SUBT.DESCRIPTION is null)
479   ));
480 
481   insert into ams_triggers_tl (
482     trigger_id,
483     CREATION_DATE,
484     CREATED_BY,
485     LAST_UPDATE_DATE,
486     last_upated_by,
487     LAST_UPDATE_LOGIN,
488     trigger_name,
489     DESCRIPTION,
490     LANGUAGE,
491     SOURCE_LANG
492   ) select
493     B.trigger_id,
494     B.CREATION_DATE,
495     B.CREATED_BY,
496     B.LAST_UPDATE_DATE,
497     B.last_upated_by,
498     B.LAST_UPDATE_LOGIN,
499     B.trigger_name,
500     B.DESCRIPTION,
501     L.LANGUAGE_CODE,
502     B.SOURCE_LANG
503   from ams_triggers_tl B, FND_LANGUAGES L
504   where L.INSTALLED_FLAG in ('I', 'B')
505   and B.LANGUAGE = userenv('LANG')
506   and not exists
507     (select NULL
508     from ams_triggers_tl T
509     where T.trigger_id = B.trigger_id
510     and T.LANGUAGE = L.LANGUAGE_CODE);
511 end ADD_LANGUAGE;
512 
513 
514 END AMS_TRIGGER_PKG;