DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_US_TIME_DEFINITIONS_HOOK

Source


1 PACKAGE BODY hxc_us_time_definitions_hook AS
2 /* $Header: hxcusottd.pkb 120.2 2006/10/05 20:18:55 asasthan noship $ */
3 /*
4    ******************************************************************
5    *                                                                *
6    *  Copyright (C) 1993 Oracle Corporation.                        *
7    *  All rights reserved.                                          *
8    *                                                                *
9    *  This material has been provided pursuant to an agreement      *
10    *  containing restrictions on its use.  The material is also     *
11    *  protected by copyright law.  No part of this material may     *
12    *  be copied or distributed, transmitted or transcribed, in      *
13    *  any form or by any means, electronic, mechanical, magnetic,   *
14    *  manual, or otherwise, or disclosed to third parties without   *
15    *  the express written permission of Oracle Corporation,         *
16    *  500 Oracle Parkway, Redwood City, CA, 94065.                  *
17    *                                                                *
18    ******************************************************************
19 
20     Name        : HXC_US_TIME_DEFINITIONS_HOOK
21     File Name   : hxcusottd.pkb
22 
23     Description : The package is called from the following places:
24                   1. After Insert Row Handler User Hook Call on
25                      HXC_PREF_HIERARCHIES
26                   2. After Update Row Handler User Hook Call on
27                      HXC_PREF_HIERARCHIES
28                   3. After Update Row Handler User Hook Call on
29                      HXC_RECURRING_PERIODS
30                   4. Before Process Business Process User Hook Call
31                      on UPDATE_TIME_DEFINITION
32 
33                   I.  The package Creates/Updates rows in pay_time_definitions
34                       and per_time_periods as and when rows are created/updated
35                       in HXC_PREF_HIERARCHIES
36                   II. The package Updates a row in pay_time_definitions as and
37                       when a row is updated in HXC_RECURRING_PERIODS
38 
39     Change List
40     -----------
41     Name           Date          Version Bug      Text
42     -------------- -----------   ------- -------  -----------------------------
43     rdhingra       24-Jan-2006   115.0   FLSA     Created
44     asasthan       05-OCT-2006   120.1   5560111  Start date of OT period
45                                                   is used to
46                                                   create row in pay_time_def
47 
48 
49   *****************************************************************************/
50 
51    /******************************************************************************
52    Name        : INSERT_TIME_DEF_HIERARCHY
53    Scope       : LOCAL
54    Description : This procedure calls core api to insert a row in
55                  pay_time_ definitions which inturn inserts rows in
56                  per_time_periods too.
57       ******************************************************************************/
58 
59 TABLE_DOES_NOT_EXIST EXCEPTION;
60 PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942);
61 
62 
63    PROCEDURE insert_time_def_hierarchy (
64       p_business_group_id   IN   NUMBER,
65       p_attribute2          IN   VARCHAR2 DEFAULT NULL,
66       p_attribute3          IN   VARCHAR2 DEFAULT NULL
67    ) IS
68 
69       lv_td_exist                     VARCHAR2 (1);
70       lv_payroll                      VARCHAR2(1);
71       lv_name                         hxc_recurring_periods.NAME%TYPE;
72       lv_period_type                  hxc_recurring_periods.period_type%TYPE;
73       ld_start_date                   hxc_recurring_periods.start_date%TYPE;
74       ld_period_start                 hxc_recurring_periods.start_date%TYPE;
75       ld_period_end                   hxc_recurring_periods.end_date%TYPE;
76       ln_duration_in_days             hxc_recurring_periods.DURATION_IN_DAYS%TYPE;
77       ln_tot_years                    NUMBER := 5;
78       ln_time_definition_id           NUMBER;
79       ln_ovn                          NUMBER;
80 
81       TYPE RefCurType IS REF CURSOR;
82       c_check_retrieval_payroll       RefCurType;
83       c_recurring_period_name         RefCurType;
84       c_check_recurring_id            RefCurType;
85 
86       c_check_retrieval_payroll_sql   VARCHAR2(10000);
87       c_recurring_period_name_sql     VARCHAR2(10000);
88       c_check_recurring_id_sql        VARCHAR2(10000);
89 
90 
91    BEGIN
92       hr_utility.TRACE('Entering INSERT_TIME_DEF_HIERARCHY');
93 
94       lv_payroll := NULL;
95       c_check_retrieval_payroll_sql :=
96                               'SELECT ''Y''
97                                  FROM hxc_retrieval_rule_comps_v hrrc,
98                                       hxc_retrieval_rules_v hrr
99                                 WHERE hrrc.time_recipient = ''Payroll''
100                                   AND hrr.retrieval_rule_id = hrrc.retrieval_rule_id
101                                   AND hrr.retrieval_rule_id = '|| p_attribute2 ;
102 
103       -- Cursor to check whether application is 'Payroll' or not.
104       OPEN c_check_retrieval_payroll FOR c_check_retrieval_payroll_sql;
105       FETCH c_check_retrieval_payroll INTO lv_payroll;
106 
107       IF c_check_retrieval_payroll%FOUND THEN
108 
109          c_recurring_period_name_sql :=
110                                 'SELECT NAME,
111                                         period_type,
112                                         start_date,
113                                         duration_in_days
114                                    FROM hxc_recurring_periods
115                                   WHERE recurring_period_id = '|| p_attribute3;
116 
117          BEGIN
118             -- Cursor which is used to fetch the recurring period related info
119             OPEN c_recurring_period_name FOR c_recurring_period_name_sql;
120             FETCH c_recurring_period_name INTO lv_name,
121                                                lv_period_type,
122                                                ld_start_date,
123                                                ln_duration_in_days;
124             CLOSE c_recurring_period_name;
125          EXCEPTION WHEN TABLE_DOES_NOT_EXIST THEN
126             hr_utility.TRACE ('Inside Exception TABLE_DOES_NOT_EXIST in '||
127                               'hxc_us_time_definitions_hook.insert_time_def_hierarchy');
128             hr_utility.set_message(801, 'PAY_US_MISSING_TABLES');
129     	    hr_utility.set_message_token(801,
130                                          'ERROR_TEXT',
131                                          'Error while inserting a row in pay_time_definitions'
132                                          );
133             hr_utility.set_message_token(801, 'TABLE_NAME', 'HXC_RECURRING_PERIODS');
134             hr_utility.raise_error;
135          END;
136 
137 
138         /* Get the OT Start Date and OT End Date of the week containing
139            sysdate by calling OTL function and assign to ld_start_date */
140 
141            hxc_timecard_utilities.find_current_period
142                          (p_rec_period_start_date      => ld_start_date,
143                           p_period_type                => lv_period_type,
144                           p_duration_in_days           => ln_duration_in_days,
145                           p_current_date               => sysdate,
146                           p_period_start               => ld_period_start,
147                           p_period_end                 => ld_period_end
148                          );
149 
150 
151          c_check_recurring_id_sql :=
152                               'SELECT /*+ INDEX (ptd PAY_TIME_DEFINITIONS_N1) */
153                                      ''Y''
154                                 FROM pay_time_definitions ptd
155                                WHERE ptd.creator_type = ''OTL_W''
156                                  and ptd.creator_id = '|| p_attribute3;
157 
158          BEGIN
159             -- Cursor to check if a row exists in pay_time_definitions
160             OPEN c_check_recurring_id FOR c_check_recurring_id_sql;
161             FETCH c_check_recurring_id INTO lv_td_exist;
162 
163             IF c_check_recurring_id%NOTFOUND THEN
164                pay_time_definition_api.create_time_definition
165                                (p_effective_date             => SYSDATE,
166                                 p_short_name                 => lv_name,
167                                 p_definition_name            => lv_name,
168                                 p_period_type                => lv_period_type,
169                                 p_business_group_id          => p_business_group_id,
170                                 p_definition_type            => 'S',/*Only Weekly from OTL*/
171                                 p_number_of_years            => ln_tot_years,
172                                 p_start_date                 => ld_period_start,
173                                 p_creator_id                 => p_attribute3,
174                                 p_creator_type               => 'OTL_W',
175                                 p_time_definition_id         => ln_time_definition_id,
176                                 p_object_version_number      => ln_ovn
177                                );
178             END IF;
179             CLOSE c_check_recurring_id;
180          EXCEPTION WHEN TABLE_DOES_NOT_EXIST THEN
181             hr_utility.TRACE ('Inside Exception TABLE_DOES_NOT_EXIST in '||
182                               'hxc_us_time_definitions_hook.insert_time_def_hierarchy');
183             hr_utility.set_message(801, 'PAY_US_MISSING_TABLES');
184     	    hr_utility.set_message_token(801,
185                                          'ERROR_TEXT',
186                                          'Error while inserting a row in pay_time_definitions'
187                                          );
188             hr_utility.set_message_token(801, 'TABLE_NAME', 'PAY_TIME_DEFINITIONS');
189             hr_utility.raise_error;
190          END;
191       END IF;
192 
193      CLOSE c_check_retrieval_payroll;
194      hr_utility.TRACE ('Leaving INSERT_TIME_DEF_HIERARCHY');
195 
196 
197      EXCEPTION WHEN TABLE_DOES_NOT_EXIST THEN
198         hr_utility.TRACE ('Inside Exception TABLE_DOES_NOT_EXIST in '||
199                           'hxc_us_time_definitions_hook.insert_time_def_hierarchy');
200         hr_utility.set_message(801, 'PAY_US_MISSING_TABLES');
201         hr_utility.set_message_token(801,
202                                      'ERROR_TEXT',
203                                      'Error while inserting a row in pay_time_definitions'
204                                      );
205     	hr_utility.set_message_token(801, 'TABLE_NAME', 'HXC_RETRIEVAL_RULE_COMPS_V, '||
206                                                         'HXC_RETRIEVAL_RULES_V'
207                                     );
208         hr_utility.raise_error;
209 
210    END insert_time_def_hierarchy;
211 
212    /******************************************************************************
213    Name        : UPDATE_TIME_DEF_RECURRING
214    Scope       : LOCAL
215    Description : This procedure calls core api to update the time definition
216                  name if it already exists
217       ******************************************************************************/
218    PROCEDURE update_time_def_recurring (
219      p_recurring_period_id  IN NUMBER
220     ,p_name                 IN VARCHAR2
221    ) IS
222 
223       ld_start_date                   pay_time_definitions.start_date%TYPE;
224       ln_time_definition_id           NUMBER;
225       ln_ovn                          NUMBER;
226 
227       TYPE RefCurType IS REF CURSOR;
228       c_check_recurring_id            RefCurType;
229 
230       c_check_recurring_id_sql        VARCHAR2(10000);
231 
232 
233    BEGIN
234       hr_utility.TRACE('Entering UPDATE_TIME_DEF_RECURRING');
235 
236       c_check_recurring_id_sql :=
237                            'SELECT  /*+ INDEX (ptd PAY_TIME_DEFINITIONS_N1) */
238                                     ptd.time_definition_id,
239                                     ptd.start_date,
240                                     ptd.object_version_number
241                                FROM pay_time_definitions ptd
242                               WHERE ptd.creator_type = ''OTL_W''
243                                 AND ptd.creator_id = '|| p_recurring_period_id;
244 
245       -- Cursor to check if a row exists in pay_time_definitions
246       OPEN c_check_recurring_id FOR c_check_recurring_id_sql;
247       FETCH c_check_recurring_id INTO ln_time_definition_id,
248                                       ld_start_date,
249                                       ln_ovn;
250       IF (c_check_recurring_id%NOTFOUND OR
251           ln_time_definition_id IS NULL) THEN
252                 NULL;
253       ELSE
254                 pay_time_definition_api.update_time_definition
255                 /*This table is not date_tracked as of now*/
256                   (p_validate                      => FALSE
257                   ,p_effective_date                => ld_start_date
258                   ,p_time_definition_id            => ln_time_definition_id
259                   ,p_definition_name               => p_name
260                   ,p_object_version_number         => ln_ovn
261                  );
262 
263       END IF;
264       CLOSE c_check_recurring_id;
265 
266       hr_utility.TRACE ('Leaving UPDATE_TIME_DEF_RECURRING');
267 
268       EXCEPTION WHEN TABLE_DOES_NOT_EXIST THEN
269         hr_utility.TRACE ('Inside Exception TABLE_DOES_NOT_EXIST in '||
270                           'hxc_us_time_definitions_hook.update_time_def_recurring');
271         hr_utility.set_message(801, 'PAY_US_MISSING_TABLES');
272         hr_utility.set_message_token(801,
273                                      'ERROR_TEXT',
274                                      'Error while updating a row in pay_time_definitions'
275                                      );
276     	hr_utility.set_message_token(801, 'TABLE_NAME', 'PAY_TIME_DEFINITIONS');
277         hr_utility.raise_error;
278    END update_time_def_recurring;
279 
280    /******************************************************************************
281    Name        : STATUS_OTL_TIME_DEF
282    Scope       : LOCAL
283    Description : This procedure verifies that apart from no of years nothing else
284                  is getting updated in the time_definition created by OTL
285       ******************************************************************************/
286    PROCEDURE status_otl_time_def (
287       p_time_definition_id         IN  NUMBER
288      ,p_definition_name            IN  VARCHAR2
289      ,p_period_type                IN  VARCHAR2
290      ,p_start_date                 IN  DATE
291      ,p_period_time_definition_id  IN  NUMBER
292    ) IS
293 
294 
295 
296       ln_is_error               NUMBER;
297       lv_def_name               pay_time_definitions.definition_name%TYPE;
298       lv_period_type            pay_time_definitions.period_type%TYPE;
299       ld_start_date             pay_time_definitions.start_date%TYPE;
300       ld_pd_td_id               pay_time_definitions.period_time_definition_id%TYPE;
301 
302       TYPE RefCurType is REF CURSOR;
303       c_get_timedef_detail      RefCurType;
304 
305       c_get_timedef_detail_sql  VARCHAR2(10000);
306 
307 
308 
309    BEGIN
310       hr_utility.TRACE('Entering STATUS_OTL_TIME_DEF');
311 
312 
313 
314       c_get_timedef_detail_sql :=
315                           'SELECT  definition_name
316                                   ,period_type
317                                   ,start_date
318                                   ,period_time_definition_id
319                               FROM pay_time_definitions
320                              WHERE time_definition_id = ' || p_time_definition_id;
321 
322       -- Cursor to get time_definition details
323       OPEN c_get_timedef_detail FOR c_get_timedef_detail_sql;
324       FETCH c_get_timedef_detail INTO lv_def_name,
325                                       lv_period_type,
326                                       ld_start_date,
327                                       ld_pd_td_id;
328       CLOSE c_get_timedef_detail;
329 
330       hr_utility.trace('p_time_definition_id :'|| p_time_definition_id);
331       hr_utility.trace('p_definition_name :'|| p_definition_name);
332       hr_utility.trace('p_period_type :'|| p_period_type);
333       hr_utility.trace('p_start_date :'|| p_start_date);
334       hr_utility.trace('p_period_time_definition_id :'|| p_period_time_definition_id);
335       hr_utility.trace('lv_def_name :'|| lv_def_name);
336       hr_utility.trace('lv_period_type :'|| lv_period_type);
337       hr_utility.trace('ld_start_date :'|| ld_start_date);
338       hr_utility.trace('ld_pd_td_id :'|| ld_pd_td_id);
339 
340       ln_is_error := 0;
341 
342       IF (p_definition_name IS NULL AND lv_def_name IS NULL) THEN
343          NULL;
344       ELSIF ((ln_is_error = 0) AND
345              ((p_definition_name IS NULL AND lv_def_name IS NOT NULL) OR
346               (p_definition_name IS NOT NULL AND lv_def_name IS NULL) OR
347               (p_definition_name <> lv_def_name)
348              )
349             )THEN
350            ln_is_error := 1;
351       END IF;
352 
353       IF ((ln_is_error = 0) AND
354           (p_period_type IS NULL) AND
355           (lv_period_type IS NULL)
356          ) THEN
357          NULL;
358       ELSIF ((ln_is_error = 0) AND
359              ((p_period_type IS NULL AND lv_period_type IS NOT NULL) OR
360               (p_period_type IS NOT NULL AND lv_period_type IS NULL) OR
361               (p_period_type <> lv_period_type)
362              )
363             )THEN
364            ln_is_error := 1;
365       END IF;
366 
367       IF ((ln_is_error = 0) AND
368           (p_start_date IS NULL) AND
369           (ld_start_date IS NULL)
370          ) THEN
371          NULL;
372       ELSIF ((ln_is_error = 0) AND
373              ((p_start_date IS NULL AND ld_start_date IS NOT NULL) OR
374               (p_start_date IS NOT NULL AND ld_start_date IS NULL) OR
375               (p_start_date <> ld_start_date)
376              )
377             )THEN
378            ln_is_error := 1;
379       END IF;
380 
381       IF ((ln_is_error = 0) AND
382           (p_period_time_definition_id IS NULL) AND
383           (ld_pd_td_id IS NULL)
384          )THEN
385          NULL;
386       ELSIF ((ln_is_error = 0) AND
387              ((p_period_time_definition_id IS NULL AND ld_pd_td_id IS NOT NULL) OR
388               (p_period_time_definition_id IS NOT NULL AND ld_pd_td_id IS NULL) OR
389               (p_period_time_definition_id <> ld_pd_td_id)
390              )
391             )THEN
392            ln_is_error := 1;
393       END IF;
394 
395       IF (ln_is_error = 1) THEN
396          hr_utility.set_message(801, 'PAY_US_INVALID_UPDATE');
397          hr_utility.set_message_token(801,
398                                       'ERROR_TEXT',
399                                       'You are only allowed to increased the number '||
400                                       'of years'
401                                       );
402          hr_utility.raise_error;
403       END IF;
404 
405 
406       hr_utility.TRACE ('Leaving STATUS_OTL_TIME_DEF');
407 
408       EXCEPTION WHEN TABLE_DOES_NOT_EXIST THEN
409          hr_utility.TRACE ('Inside Exception TABLE_DOES_NOT_EXIST in '||
410                            'hxc_us_time_definitions_hook.status_otl_time_def');
411          hr_utility.set_message(801, 'PAY_US_MISSING_TABLES');
412          hr_utility.set_message_token(801,
413                                       'ERROR_TEXT',
414                                       'Error while updating a row in pay_time_definitions'
415                                       );
416          hr_utility.set_message_token(801, 'TABLE_NAME', 'PAY_TIME_DEFINITIONS');
417          hr_utility.raise_error;
418 
419    END status_otl_time_def;
420 
421 
422 /******************************************************************************
423    Name        : INSERT_USER_HOOK_HIERARCHY
424    Scope       : GLOBAL
425    Description : This procedure is called by AFTER INSERT Row Level handler
426                  User Hook of HXC_PREF_HIERARCHIES to insert a row in
427                  pay_time_definitions if it does not already exist.
428 ******************************************************************************/
429    PROCEDURE insert_user_hook_hierarchy (
430       p_business_group_id    IN   NUMBER,
431       p_legislation_code     IN   VARCHAR2 DEFAULT NULL,
432       p_attribute_category   IN   VARCHAR2 DEFAULT NULL,
433       p_attribute1           IN   VARCHAR2 DEFAULT NULL,
434       p_attribute2           IN   VARCHAR2 DEFAULT NULL,
435       p_attribute3           IN   VARCHAR2 DEFAULT NULL
436    ) IS
437    BEGIN
438       hr_utility.TRACE('Entering HXC_US_TIME_DEFINITIONS_HOOK.INSERT_USER_HOOK_HIERARCHY');
439 
440       IF ( p_attribute_category = 'TC_W_RULES_EVALUATION' AND
441            p_attribute2 IS NOT NULL AND
442            p_attribute3 IS NOT NULL
443          ) THEN
444          insert_time_def_hierarchy ( p_business_group_id => p_business_group_id
445                                     ,p_attribute2        => p_attribute2
446                                     ,p_attribute3        => p_attribute3
447                                    );
448       ELSE
449          NULL;
450       END IF;
451 
452       hr_utility.TRACE ('Leaving HXC_US_TIME_DEFINITIONS_HOOK.INSERT_USER_HOOK_HIERARCHY');
453    END insert_user_hook_hierarchy;
454 
455 ------------------------INSERT_USER_HOOK_HIERARCHY ENDS HERE-------------------
456 
457 /******************************************************************************
458    Name        : UPDATE_USER_HOOK_HIERARCHY
459    Scope       : GLOBAL
460    Description : This procedure is called by AFTER UPDATE Row Level handler
461                  User Hook of HXC_PREF_HIERARCHIES to insert a row in
462                  pay_time_definitions if it does not already exist.
463 ******************************************************************************/
464    PROCEDURE update_user_hook_hierarchy (
465       p_business_group_id    IN   NUMBER,
466       p_legislation_code     IN   VARCHAR2 DEFAULT NULL,
467       p_attribute_category   IN   VARCHAR2 DEFAULT NULL,
468       p_attribute1           IN   VARCHAR2 DEFAULT NULL,
469       p_attribute2           IN   VARCHAR2 DEFAULT NULL,
470       p_attribute3           IN   VARCHAR2 DEFAULT NULL
471    ) IS
472 
473    BEGIN
474       hr_utility.TRACE('Entering HXC_US_TIME_DEFINITIONS_HOOK.UPDATE_USER_HOOK_HIERARCHY');
475 
476       IF ( p_attribute_category = 'TC_W_RULES_EVALUATION' AND
477            p_attribute2 IS NOT NULL AND
478            p_attribute3 IS NOT NULL
479          ) THEN
480          insert_time_def_hierarchy ( p_business_group_id => p_business_group_id
481                                     ,p_attribute2        => p_attribute2
482                                     ,p_attribute3        => p_attribute3
483                                    );
484       ELSE
485          NULL;
486       END IF;
487 
488       hr_utility.TRACE ('Leaving HXC_US_TIME_DEFINITIONS_HOOK.UPDATE_USER_HOOK_HIERARCHY');
489    END update_user_hook_hierarchy;
490 
491 -------------------------UPDATE_USER_HOOK_HIERARCHY ENDS HERE------------------
492 
493    /***************************************************************************
494       Name        : UPDATE_USER_HOOK_RECURRING
495       Scope       : GLOBAL
496       Description : This procedure is called by AFTER UPDATE Row Level handler
497                     User Hook of HXC_RECURRING_PERIODS_API.
498    ******************************************************************************/
499    PROCEDURE update_user_hook_recurring (
500      p_recurring_period_id  IN NUMBER
501     ,p_name                 IN VARCHAR2
502   ) IS
503    BEGIN
504       hr_utility.TRACE('Entering HXC_US_TIME_DEFINITIONS_HOOK.UPDATE_USER_HOOK_RECURRING');
505 
506       g_from_otl := 'Y';
507       update_time_def_recurring ( p_recurring_period_id => p_recurring_period_id
508                                  ,p_name                => p_name
509                                 );
510 
511        hr_utility.TRACE ('Leaving HXC_US_TIME_DEFINITIONS_HOOK.UPDATE_USER_HOOK_RECURRING');
512    END update_user_hook_recurring;
513 
514 -----------------------UPDATE_USER_HOOK_RECURRING SECTION ENDS HERE------------
515 
516    /***************************************************************************
517       Name        : UPDATE_USER_HOOK_TIMEDEF
518       Scope       : GLOBAL
519       Description : This procedure is called by Before Process
520                     Business Process User Hook of PAY_TIME_DEFINITION_API.
521    ******************************************************************************/
522    PROCEDURE update_user_hook_timedef (
523      p_time_definition_id         IN  NUMBER
524     ,p_definition_name            IN  VARCHAR2
525     ,p_period_type                IN  VARCHAR2
526     ,p_start_date                 IN  DATE
527     ,p_period_time_definition_id  IN  NUMBER
528     ,p_creator_id                 IN  NUMBER
529     ,p_creator_type               IN  VARCHAR2
530    ) IS
531 
532 
533       lv_rec_pd_exist        VARCHAR2(1);
534 
535       TYPE RefCurType is REF CURSOR;
536       c_check_recurring      RefCurType;
537 
538       c_check_recurring_sql  VARCHAR2(10000);
539 
540    BEGIN
541       hr_utility.TRACE('Entering HXC_US_TIME_DEFINITIONS_HOOK.UPDATE_USER_HOOK_TIMEDEF');
542 
543       IF g_from_otl IS NULL THEN
544          g_from_otl := 'N';
545       END IF;
546 
547       hr_utility.trace('g_from_otl :'|| g_from_otl);
548       IF (g_from_otl = 'Y') THEN
549           g_from_otl := 'N';
550       ELSIF (p_creator_id IS NOT NULL AND
551              p_creator_type = 'OTL_W') THEN
552          BEGIN
553 
554             c_check_recurring_sql :=
555                               'SELECT ''Y''
556                                  FROM hxc_recurring_periods
557                                 WHERE recurring_period_id = ' || p_creator_id;
558 
559             -- Cursor to check whether a recurring period exist
560             OPEN c_check_recurring FOR c_check_recurring_sql;
561             FETCH c_check_recurring INTO lv_rec_pd_exist;
562 
563             IF (c_check_recurring%NOTFOUND) THEN
564                    /*Call has not come for updation of a time_definition which
565                      was created through OTL. Hence do nothing*/
566                    NULL;
567             ELSE
568                      hr_utility.trace('p_time_definition_id :'|| p_time_definition_id);
569                      hr_utility.trace('p_definition_name :'|| p_definition_name);
570                      hr_utility.trace('p_period_type :'|| p_period_type);
571                      hr_utility.trace('p_start_date :'|| p_start_date);
572                      hr_utility.trace('p_period_time_definition_id :'|| p_period_time_definition_id);
573                    /*Need to verify that leaving number_of_years nothing else
574                      is getting updated*/
575                    status_otl_time_def(
576                        p_time_definition_id        =>  p_time_definition_id
577                       ,p_definition_name           =>  p_definition_name
578                       ,p_period_type               =>  p_period_type
579                       ,p_start_date                =>  p_start_date
580                       ,p_period_time_definition_id =>  p_period_time_definition_id
581                       );
582             END IF;
583             CLOSE c_check_recurring;
584          EXCEPTION WHEN TABLE_DOES_NOT_EXIST THEN
585             hr_utility.TRACE ('Inside Exception TABLE_DOES_NOT_EXIST in '||
586                               'hxc_us_time_definitions_hook.status_otl_time_def');
587             hr_utility.set_message(801, 'PAY_US_MISSING_TABLES');
588             hr_utility.set_message_token(801,
589                                          'ERROR_TEXT',
590                                          'Error while updating a row in pay_time_definitions'
591                                          );
592       	    hr_utility.set_message_token(801, 'TABLE_NAME', 'HXC_RECURRING_PERIODS');
593             hr_utility.raise_error;
594          END;
595       END IF;
596       hr_utility.TRACE ('Leaving HXC_US_TIME_DEFINITIONS_HOOK.UPDATE_USER_HOOK_TIMEDEF');
597    END update_user_hook_timedef;
598 
599 -----------------------------UPDATE_USER_HOOK_TIMEDEF ENDS HERE----------------
600 
601 --BEGIN
602 --hr_utility.trace_on(NULL,'rd_hxcusottd');
603 
604 END hxc_us_time_definitions_hook;