1: Package Body hxc_resource_rules_utils as
2: /* $Header: hxchrrutl.pkb 120.3.12010000.4 2009/11/11 06:32:10 amakrish ship $ */
3: --
4: g_debug boolean :=hr_utility.debug_enabled;
5:
6: PROCEDURE get_value_set_sql ( p_flex_Field_name varchar2
7: , p_legislation_code varchar2 ) IS
8:
261: l_seq NUMBER(2) := 1;
262:
263:
264: BEGIN
265: g_debug:=hr_utility.debug_enabled;
266: if g_debug then
267: hr_utility.set_location('gaz - in get sequence',10);
268: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
269: end if;
263:
264: BEGIN
265: g_debug:=hr_utility.debug_enabled;
266: if g_debug then
267: hr_utility.set_location('gaz - in get sequence',10);
268: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
269: end if;
270:
271: IF (SUBSTR(p_type, 1, 3) = 'SCL')
264: BEGIN
265: g_debug:=hr_utility.debug_enabled;
266: if g_debug then
267: hr_utility.set_location('gaz - in get sequence',10);
268: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
269: end if;
270:
271: IF (SUBSTR(p_type, 1, 3) = 'SCL')
272: THEN
270:
271: IF (SUBSTR(p_type, 1, 3) = 'SCL')
272: THEN
273: if g_debug then
274: hr_utility.set_location('gaz - in get sequence',20);
275: end if;
276:
277: -- loop to find a value - sometimes null when keyflex
278: -- has had different number of segments and concatenated segment value
280:
281: FOR scl IN csr_scl_get_seq
282: LOOP
283: if g_debug then
284: hr_utility.set_location('gaz - in get sequence',30);
285: end if;
286:
287: IF ( scl.application_column_name = SUBSTR( p_type, 5 ) )
288: THEN
295:
296: ELSIF ( SUBSTR( p_type, 1, 6) = 'PEOPLE' )
297: THEN
298: if g_debug then
299: hr_utility.set_location('gaz - in get sequence',40);
300: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
301: end if;
302:
303: FOR grp IN csr_people_get_seq
296: ELSIF ( SUBSTR( p_type, 1, 6) = 'PEOPLE' )
297: THEN
298: if g_debug then
299: hr_utility.set_location('gaz - in get sequence',40);
300: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
301: end if;
302:
303: FOR grp IN csr_people_get_seq
304: LOOP
302:
303: FOR grp IN csr_people_get_seq
304: LOOP
305: if g_debug then
306: hr_utility.set_location('gaz - in get sequence',50);
307: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
308: end if;
309:
310: IF ( grp.application_column_name = SUBSTR( p_type, 8 ) )
303: FOR grp IN csr_people_get_seq
304: LOOP
305: if g_debug then
306: hr_utility.set_location('gaz - in get sequence',50);
307: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
308: end if;
309:
310: IF ( grp.application_column_name = SUBSTR( p_type, 8 ) )
311: THEN
315: l_seq := l_seq + 1;
316:
317: END LOOP;
318: if g_debug then
319: hr_utility.set_location('gaz - in get sequence',60);
320: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
321: end if;
322:
323: ELSIF ( SUBSTR( p_type, 1, 5) = 'GRADE' )
316:
317: END LOOP;
318: if g_debug then
319: hr_utility.set_location('gaz - in get sequence',60);
320: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
321: end if;
322:
323: ELSIF ( SUBSTR( p_type, 1, 5) = 'GRADE' )
324: THEN
322:
323: ELSIF ( SUBSTR( p_type, 1, 5) = 'GRADE' )
324: THEN
325: if g_debug then
326: hr_utility.set_location('gaz - in get sequence',70);
327: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
328: end if;
329:
330: FOR grd IN csr_grade_get_seq
323: ELSIF ( SUBSTR( p_type, 1, 5) = 'GRADE' )
324: THEN
325: if g_debug then
326: hr_utility.set_location('gaz - in get sequence',70);
327: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
328: end if;
329:
330: FOR grd IN csr_grade_get_seq
331: LOOP
329:
330: FOR grd IN csr_grade_get_seq
331: LOOP
332: if g_debug then
333: hr_utility.set_location('gaz - in get sequence',80);
334: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
335: end if;
336:
337: IF ( grd.application_column_name = SUBSTR( p_type, 7 ) )
330: FOR grd IN csr_grade_get_seq
331: LOOP
332: if g_debug then
333: hr_utility.set_location('gaz - in get sequence',80);
334: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
335: end if;
336:
337: IF ( grd.application_column_name = SUBSTR( p_type, 7 ) )
338: THEN
342: l_seq := l_seq + 1;
343:
344: END LOOP;
345: if g_debug then
346: hr_utility.set_location('gaz - in get sequence',90);
347: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
348: end if;
349:
350: END IF;
343:
344: END LOOP;
345: if g_debug then
346: hr_utility.set_location('gaz - in get sequence',90);
347: hr_utility.set_location('gaz - l seq is '||to_char(l_seq),10);
348: end if;
349:
350: END IF;
351:
718:
719: IF ( SUBSTR( p_type,1,3) = 'SCL' )
720: THEN
721: if g_debug then
722: hr_utility.set_location('gaz - num of segs is '||to_Char(hxc_resource_rules_utils.g_scl_num_of_segs), 999);
723: end if;
724: IF ( hxc_resource_rules_utils.g_scl_num_of_segs IS NULL )
725: THEN
726: OPEN csr_get_scl_segs;
731: CLOSE csr_get_scl_segs;
732:
733: END IF;
734: if g_debug then
735: hr_utility.set_location('gaz - num of segs is '||to_Char(hxc_resource_rules_utils.g_scl_num_of_segs), 999);
736: end if;
737:
738: -- get sequence
739:
741:
742: -- get value
743:
744: if g_debug then
745: hr_utility.set_location('gaz - params are ', 999);
746: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_scl_id_flex_num) , 999);
747: hr_utility.set_location('gaz - p sequence '||to_char(l_Sequence) , 999);
748: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_scl_num_of_segs) , 999);
749: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_scl_delimiter , 999);
742: -- get value
743:
744: if g_debug then
745: hr_utility.set_location('gaz - params are ', 999);
746: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_scl_id_flex_num) , 999);
747: hr_utility.set_location('gaz - p sequence '||to_char(l_Sequence) , 999);
748: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_scl_num_of_segs) , 999);
749: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_scl_delimiter , 999);
750: hr_utility.set_location('gaz - p type '||p_type , 999);
743:
744: if g_debug then
745: hr_utility.set_location('gaz - params are ', 999);
746: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_scl_id_flex_num) , 999);
747: hr_utility.set_location('gaz - p sequence '||to_char(l_Sequence) , 999);
748: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_scl_num_of_segs) , 999);
749: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_scl_delimiter , 999);
750: hr_utility.set_location('gaz - p type '||p_type , 999);
751: hr_utility.set_location('gaz - p value '||p_value , 999);
744: if g_debug then
745: hr_utility.set_location('gaz - params are ', 999);
746: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_scl_id_flex_num) , 999);
747: hr_utility.set_location('gaz - p sequence '||to_char(l_Sequence) , 999);
748: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_scl_num_of_segs) , 999);
749: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_scl_delimiter , 999);
750: hr_utility.set_location('gaz - p type '||p_type , 999);
751: hr_utility.set_location('gaz - p value '||p_value , 999);
752: end if;
745: hr_utility.set_location('gaz - params are ', 999);
746: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_scl_id_flex_num) , 999);
747: hr_utility.set_location('gaz - p sequence '||to_char(l_Sequence) , 999);
748: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_scl_num_of_segs) , 999);
749: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_scl_delimiter , 999);
750: hr_utility.set_location('gaz - p type '||p_type , 999);
751: hr_utility.set_location('gaz - p value '||p_value , 999);
752: end if;
753:
746: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_scl_id_flex_num) , 999);
747: hr_utility.set_location('gaz - p sequence '||to_char(l_Sequence) , 999);
748: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_scl_num_of_segs) , 999);
749: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_scl_delimiter , 999);
750: hr_utility.set_location('gaz - p type '||p_type , 999);
751: hr_utility.set_location('gaz - p value '||p_value , 999);
752: end if;
753:
754: FOR scl IN csr_get_scl_meaning (
747: hr_utility.set_location('gaz - p sequence '||to_char(l_Sequence) , 999);
748: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_scl_num_of_segs) , 999);
749: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_scl_delimiter , 999);
750: hr_utility.set_location('gaz - p type '||p_type , 999);
751: hr_utility.set_location('gaz - p value '||p_value , 999);
752: end if;
753:
754: FOR scl IN csr_get_scl_meaning (
755: p_id_flex_num => hxc_resource_rules_utils.g_scl_id_flex_num
770:
771: ELSIF ( SUBSTR( p_type,1,6) = 'PEOPLE' )
772: THEN
773: if g_debug then
774: hr_utility.set_location('gaz - num of segs is '||to_Char(hxc_resource_rules_utils.g_people_num_of_segs), 999);
775: end if;
776: IF ( hxc_resource_rules_utils.g_people_num_of_segs IS NULL )
777: THEN
778: OPEN csr_get_people_segs;
783: CLOSE csr_get_people_segs;
784:
785: END IF;
786: if g_debug then
787: hr_utility.set_location('gaz - num of segs is '||to_Char(hxc_resource_rules_utils.g_people_num_of_segs), 999);
788: end if;
789:
790: -- get sequence
791:
793:
794: -- get value
795:
796: if g_debug then
797: hr_utility.set_location('gaz - params are ', 999);
798: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_people_id_flex_num) , 999);
799: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
800: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_people_num_of_segs) , 999);
801: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_people_delimiter , 999);
794: -- get value
795:
796: if g_debug then
797: hr_utility.set_location('gaz - params are ', 999);
798: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_people_id_flex_num) , 999);
799: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
800: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_people_num_of_segs) , 999);
801: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_people_delimiter , 999);
802: hr_utility.set_location('gaz - p type '||p_type , 999);
795:
796: if g_debug then
797: hr_utility.set_location('gaz - params are ', 999);
798: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_people_id_flex_num) , 999);
799: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
800: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_people_num_of_segs) , 999);
801: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_people_delimiter , 999);
802: hr_utility.set_location('gaz - p type '||p_type , 999);
803: hr_utility.set_location('gaz - p value '||p_value , 999);
796: if g_debug then
797: hr_utility.set_location('gaz - params are ', 999);
798: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_people_id_flex_num) , 999);
799: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
800: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_people_num_of_segs) , 999);
801: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_people_delimiter , 999);
802: hr_utility.set_location('gaz - p type '||p_type , 999);
803: hr_utility.set_location('gaz - p value '||p_value , 999);
804: end if;
797: hr_utility.set_location('gaz - params are ', 999);
798: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_people_id_flex_num) , 999);
799: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
800: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_people_num_of_segs) , 999);
801: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_people_delimiter , 999);
802: hr_utility.set_location('gaz - p type '||p_type , 999);
803: hr_utility.set_location('gaz - p value '||p_value , 999);
804: end if;
805:
798: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_people_id_flex_num) , 999);
799: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
800: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_people_num_of_segs) , 999);
801: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_people_delimiter , 999);
802: hr_utility.set_location('gaz - p type '||p_type , 999);
803: hr_utility.set_location('gaz - p value '||p_value , 999);
804: end if;
805:
806: FOR people IN csr_get_people_meaning (
799: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
800: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_people_num_of_segs) , 999);
801: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_people_delimiter , 999);
802: hr_utility.set_location('gaz - p type '||p_type , 999);
803: hr_utility.set_location('gaz - p value '||p_value , 999);
804: end if;
805:
806: FOR people IN csr_get_people_meaning (
807: p_id_flex_num => hxc_resource_rules_utils.g_people_id_flex_num
820:
821: END LOOP;
822:
823: if g_debug then
824: hr_utility.set_location('gaz - meaning is '||l_meaning, 999);
825: end if;
826:
827: ELSIF ( SUBSTR( p_type,1,5) = 'GRADE' )
828: THEN
826:
827: ELSIF ( SUBSTR( p_type,1,5) = 'GRADE' )
828: THEN
829: if g_debug then
830: hr_utility.set_location('gaz - num of segs is '||to_Char(hxc_resource_rules_utils.g_grade_num_of_segs), 999);
831: end if;
832: IF ( hxc_resource_rules_utils.g_grade_num_of_segs IS NULL )
833: THEN
834: OPEN csr_get_grade_segs;
839: CLOSE csr_get_grade_segs;
840:
841: END IF;
842: if g_debug then
843: hr_utility.set_location('gaz - num of segs is '||to_Char(hxc_resource_rules_utils.g_grade_num_of_segs), 999);
844: end if;
845:
846: -- get sequence
847:
849:
850: -- get value
851:
852: if g_debug then
853: hr_utility.set_location('gaz - params are ', 999);
854: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_grade_id_flex_num) , 999);
855: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
856: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_grade_num_of_segs) , 999);
857: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_grade_delimiter , 999);
850: -- get value
851:
852: if g_debug then
853: hr_utility.set_location('gaz - params are ', 999);
854: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_grade_id_flex_num) , 999);
855: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
856: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_grade_num_of_segs) , 999);
857: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_grade_delimiter , 999);
858: hr_utility.set_location('gaz - p type '||p_type , 999);
851:
852: if g_debug then
853: hr_utility.set_location('gaz - params are ', 999);
854: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_grade_id_flex_num) , 999);
855: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
856: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_grade_num_of_segs) , 999);
857: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_grade_delimiter , 999);
858: hr_utility.set_location('gaz - p type '||p_type , 999);
859: hr_utility.set_location('gaz - p value '||p_value , 999);
852: if g_debug then
853: hr_utility.set_location('gaz - params are ', 999);
854: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_grade_id_flex_num) , 999);
855: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
856: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_grade_num_of_segs) , 999);
857: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_grade_delimiter , 999);
858: hr_utility.set_location('gaz - p type '||p_type , 999);
859: hr_utility.set_location('gaz - p value '||p_value , 999);
860: end if;
853: hr_utility.set_location('gaz - params are ', 999);
854: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_grade_id_flex_num) , 999);
855: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
856: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_grade_num_of_segs) , 999);
857: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_grade_delimiter , 999);
858: hr_utility.set_location('gaz - p type '||p_type , 999);
859: hr_utility.set_location('gaz - p value '||p_value , 999);
860: end if;
861:
854: hr_utility.set_location('gaz - p id_flex_num '||to_char(hxc_resource_rules_utils.g_grade_id_flex_num) , 999);
855: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
856: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_grade_num_of_segs) , 999);
857: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_grade_delimiter , 999);
858: hr_utility.set_location('gaz - p type '||p_type , 999);
859: hr_utility.set_location('gaz - p value '||p_value , 999);
860: end if;
861:
862: FOR grade IN csr_get_grade_meaning (
855: hr_utility.set_location('gaz - l sequence '||to_char(l_Sequence) , 999);
856: hr_utility.set_location('gaz - p max sequence '||to_char(hxc_resource_rules_utils.g_grade_num_of_segs) , 999);
857: hr_utility.set_location('gaz - p delim '||hxc_resource_rules_utils.g_grade_delimiter , 999);
858: hr_utility.set_location('gaz - p type '||p_type , 999);
859: hr_utility.set_location('gaz - p value '||p_value , 999);
860: end if;
861:
862: FOR grade IN csr_get_grade_meaning (
863: p_id_flex_num => hxc_resource_rules_utils.g_grade_id_flex_num
871: IF grade.meaning is not null
872: THEN
873: l_meaning := grade.meaning;
874: if g_debug then
875: hr_utility.set_location('gaz - meaning is '||l_meaning, 999);
876: end if;
877: exit;
878: END IF;
879: