310: /* ARPATEL: 10/16, bug#2832442 */
311: --parse the resource_id to extract the resource_type
312: select SUBSTR(p_param1, 1,INSTR(p_param1, 'R')-1)
313: into l_resource_id
314: from dual;
315:
316: select SUBSTR(p_param1, INSTR(p_param1, 'R'))
317: into l_resource_type
318: from dual;
314: from dual;
315:
316: select SUBSTR(p_param1, INSTR(p_param1, 'R'))
317: into l_resource_type
318: from dual;
319:
320: /* ARPATEL: 10/16, END OF bug#2832442 */
321:
322: --dbms_output.put_line('get territory by property');
544: then
545: if rec_qual_value.COMPARISON_OPERATOR = 'BETWEEN'
546: then
547: begin
548: select 1 into l_match_qual from dual
549: where UPPER(p_param3) BETWEEN lx_result_tbl(l_out_index).column9 and lx_result_tbl(l_out_index).column10;
550:
551: exception
552: when no_data_found then l_match_qual := 0;
556:
557: if rec_qual_value.COMPARISON_OPERATOR = '='
558: then
559: begin
560: select 1 into l_match_qual from dual
561: where UPPER(p_param3) = lx_result_tbl(l_out_index).column9;
562:
563: exception
564: when no_data_found then l_match_qual := 0;
568:
569: if rec_qual_value.COMPARISON_OPERATOR = 'LIKE'
570: then
571: begin
572: select 1 into l_match_qual from dual
573: where UPPER(p_param3) LIKE lx_result_tbl(l_out_index).column9;
574:
575: exception
576: when no_data_found then l_match_qual := 0;
597:
598: if rec_qual_value.COMPARISON_OPERATOR = 'BETWEEN'
599: then
600: begin
601: select 1 into l_match_qual from dual
602: where UPPER(p_param4) BETWEEN lx_result_tbl(l_out_index).column9 and lx_result_tbl(l_out_index).column10;
603:
604: exception
605: when no_data_found then l_match_qual := 0;
609:
610: if rec_qual_value.COMPARISON_OPERATOR = '='
611: then
612: begin
613: select 1 into l_match_qual from dual
614: where UPPER(p_param4) = lx_result_tbl(l_out_index).column9;
615:
616: exception
617: when no_data_found then l_match_qual := 0;
621:
622: if rec_qual_value.COMPARISON_OPERATOR = 'LIKE'
623: then
624: begin
625: select 1 into l_match_qual from dual
626: where UPPER(p_param4) LIKE lx_result_tbl(l_out_index).column9;
627:
628: exception
629: when no_data_found then l_match_qual := 0;
832: --ACTIVE GLOBAL CURSOR
833: cursor c_ACTIVE_GLOBAL IS
834: SELECT 'All' name,
835: atc.ACTIVE_TERR_COUNT ACTIVE_TERR_COUNT,
836: tdac.TERR_DUAL_ASSGN_COUNT TERR_DUAL_ASSGN_COUNT,
837: tcc.TERR_CREATED_COUNT TERR_CREATED_COUNT,
838: tsdc.TERR_SOFT_DEL_COUNT TERR_SOFT_DEL_COUNT,
839: tuc.TERR_UPDATED_COUNT TERR_UPDATED_COUNT,
840: arc.ACTIVE_DIST_REP_COUNT ACTIVE_DIST_REP_COUNT,
848: WHERE jtdr.source_id = p_param2 and jtdr.terr_id = jt.terr_id )
849: ) atc,
850:
851: -- Total # of Territories that have Internal and External Reps
852: ( SELECT COUNT(*) TERR_DUAL_ASSGN_COUNT
853: FROM jtf_terr_all jt
854: WHERE EXISTS ( SELECT jtdr.terr_id
855: FROM jtf_terr_denorm_rules_all jtdr
856: WHERE jtdr.source_id = p_param2 and jtdr.terr_id = jt.terr_id )
904: cursor c_ACTIVE_BY_COUNTRY IS
905: SELECT
906: houo.name name,
907: NVL(atc.ACTIVE_TERR_COUNT, 0) ACTIVE_TERR_COUNT,
908: NVL(tdac.TERR_DUAL_ASSGN_COUNT, 0) TERR_DUAL_ASSGN_COUNT,
909: NVL(tcc.TERR_CREATED_COUNT, 0) TERR_CREATED_COUNT,
910: NVL(tsdc.TERR_SOFT_DEL_COUNT, 0) TERR_SOFT_DEL_COUNT,
911: NVL(tuc.TERR_UPDATED_COUNT, 0) TERR_UPDATED_COUNT,
912: NVL(arc.ACTIVE_DIST_REP_COUNT, 0) ACTIVE_DIST_REP_COUNT,
933: -- Total # of Territories that have Internal and External Reps
934: ( SELECT
935: hou.name,
936: hou.organization_id,
937: COUNT(*) TERR_DUAL_ASSGN_COUNT
938: FROM jtf_terr_all jt, hr_organization_units hou
939: WHERE jt.org_id = hou.organization_id
940: AND EXISTS ( SELECT jtdr.terr_id
941: FROM jtf_terr_denorm_rules_all jtdr
1059: l_out_index := l_out_index + 1;
1060: lx_result_tbl.extend;
1061: lx_result_tbl(l_out_index).column1 := actglobal_type.name;
1062: lx_result_tbl(l_out_index).column2 := actglobal_type.ACTIVE_TERR_COUNT;
1063: lx_result_tbl(l_out_index).column3 := actglobal_type.TERR_DUAL_ASSGN_COUNT;
1064: lx_result_tbl(l_out_index).column4 := actglobal_type.TERR_CREATED_COUNT;
1065: lx_result_tbl(l_out_index).column5 := actglobal_type.TERR_SOFT_DEL_COUNT;
1066: lx_result_tbl(l_out_index).column6 := actglobal_type.TERR_UPDATED_COUNT;
1067: lx_result_tbl(l_out_index).column7 := actglobal_type.ACTIVE_DIST_REP_COUNT;
1076: l_out_index := l_out_index + 1;
1077: lx_result_tbl.extend;
1078: lx_result_tbl(l_out_index).column1 := actcountry_type.name;
1079: lx_result_tbl(l_out_index).column2 := actcountry_type.ACTIVE_TERR_COUNT;
1080: lx_result_tbl(l_out_index).column3 := actcountry_type.TERR_DUAL_ASSGN_COUNT;
1081: lx_result_tbl(l_out_index).column4 := actcountry_type.TERR_CREATED_COUNT;
1082: lx_result_tbl(l_out_index).column5 := actcountry_type.TERR_SOFT_DEL_COUNT;
1083: lx_result_tbl(l_out_index).column6 := actcountry_type.TERR_UPDATED_COUNT;
1084: lx_result_tbl(l_out_index).column7 := actcountry_type.ACTIVE_DIST_REP_COUNT;