DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRI_OLTP_PMV_WMV_TRN_CTR

Source


1 PACKAGE BODY hri_oltp_pmv_wmv_trn_ctr AS
2 /* $Header: hriopwtc.pkb 120.0 2005/05/29 07:39:30 appldev noship $ */
3 
4   g_rtn     VARCHAR2(5) := '
5 ';
6 
7 PROCEDURE GET_SQL_CTR_T4
8   (p_page_parameter_tbl  IN BIS_PMV_PAGE_PARAMETER_TBL,
9    x_custom_sql          OUT NOCOPY VARCHAR2,
10    x_custom_output       OUT NOCOPY BIS_QUERY_ATTRIBUTES_TBL) IS
11 
12   l_sqltext                 VARCHAR2(32767);
13   l_custom_rec              BIS_QUERY_ATTRIBUTES;
14   l_security_clause         VARCHAR2(4000);
15 
16 -- Parameter values
17   l_parameter_rec         hri_oltp_pmv_util_param.HRI_PMV_PARAM_REC_TYPE;
18   l_bind_tab              hri_oltp_pmv_util_param.HRI_PMV_BIND_TAB_TYPE;
19   l_country_tab           hri_oltp_pmv_rank_ctr.country_tab_type;
20 
21 -- Trend Period Parameters
22   l_projection_periods  NUMBER;
23   l_previous_periods    NUMBER;
24   l_trend_sql           VARCHAR2(10000);
25   l_trend_sql_params    hri_oltp_pmv_query_trend.trend_sql_params_type;
26 
27 -- Annualization factor for period type parameter
28   l_calc_anl_factor     NUMBER;
29 
30 BEGIN
31 
32 /* Initialize out parameters */
33   l_custom_rec := BIS_PMV_PARAMETERS_PUB.INITIALIZE_QUERY_TYPE;
34   x_custom_output := BIS_QUERY_ATTRIBUTES_TBL();
35 
36 /* Get common parameter values */
37   hri_oltp_pmv_util_param.get_parameters_from_table
38         (p_page_parameter_tbl  => p_page_parameter_tbl,
39          p_parameter_rec       => l_parameter_rec,
40          p_bind_tab            => l_bind_tab);
41 
42 /* Get security clause for Manager based security */
43   l_security_clause := hri_oltp_pmv_util_pkg.get_security_clause('MGR');
44 
45 /* Get the annualization factor for the different periods */
46   l_calc_anl_factor := hri_oltp_pmv_util_pkg.calc_anl_factor
47                           (p_period_type  => l_parameter_rec.page_period_type);
48 
49 /* Get bind values for number of time periods */
50   hri_oltp_pmv_query_time.get_period_binds
51           (p_page_period_type    => l_parameter_rec.page_period_type
52           ,p_page_comp_type      => l_parameter_rec.time_comparison_type
53           ,o_previous_periods    => l_previous_periods
54           ,o_projection_periods  => l_projection_periods);
55 
56 /* Get the top 4 countries */
57   hri_oltp_pmv_rank_ctr.set_top_countries
58    (p_supervisor_id => l_parameter_rec.peo_supervisor_id,
59     p_effective_date => l_parameter_rec.time_curr_end_date,
60     p_no_countries => 4,
61     p_country_tab => l_country_tab);
62 
63 /* Get the trend sql */
64   l_trend_sql_params.bind_format := 'PMV';
65   l_trend_sql_params.include_hdc := 'Y';
66   l_trend_sql_params.include_sep := 'Y';
67   l_trend_sql_params.bucket_dim := 'GEOGRAPHY+COUNTRY';
68   l_trend_sql := hri_oltp_pmv_query_trend.get_sql
69                   (p_parameter_rec    => l_parameter_rec,
70                    p_bind_tab         => l_bind_tab,
71                    p_trend_sql_params => l_trend_sql_params,
72                    p_calling_module   => 'HRI_OLTP_PMV_WMV_TRN_CTR.GET_SQL_CTR_T4');
73 
74 l_sqltext :=
75 'SELECT -- Terminations by Top 4 Country Trend
76  qry.period_as_of_date     VIEWBYID
77 ,qry.period_as_of_date     VIEWBY
78 ,qry.period_order          HRI_P_ORDER_BY_1
79 ,qry.period_sep_hdc_ctr1   HRI_P_MEASURE1
80 ,DECODE(qry.period_sep_hdc_ctr1,
81    0, 0,
82  qry.period_sep_hdc_ctr1 * :ANL_FACTOR * 100 /
83  DECODE(qry.period_hdc_trn_ctr1,
84           0, qry.period_sep_hdc_ctr1,
85         qry.period_hdc_trn_ctr1))  HRI_P_MEASURE1_MP
86 ,qry.period_sep_hdc_ctr2   HRI_P_MEASURE2
87 ,DECODE(qry.period_sep_hdc_ctr2,
88    0, 0,
89  qry.period_sep_hdc_ctr2 * :ANL_FACTOR * 100 /
90  DECODE(qry.period_hdc_trn_ctr2,
91           0, qry.period_sep_hdc_ctr2,
92         qry.period_hdc_trn_ctr2))  HRI_P_MEASURE2_MP
93 ,qry.period_sep_hdc_ctr3   HRI_P_MEASURE3
94 ,DECODE(qry.period_sep_hdc_ctr3,
95    0, 0,
96  qry.period_sep_hdc_ctr3 * :ANL_FACTOR * 100 /
97  DECODE(qry.period_hdc_trn_ctr3,
98           0, qry.period_sep_hdc_ctr3,
99         qry.period_hdc_trn_ctr3))  HRI_P_MEASURE3_MP
100 ,qry.period_sep_hdc_ctr4   HRI_P_MEASURE4
101 ,DECODE(qry.period_sep_hdc_ctr4,
102    0, 0,
103  qry.period_sep_hdc_ctr4 * :ANL_FACTOR * 100 /
104  DECODE(qry.period_hdc_trn_ctr4,
105           0, qry.period_sep_hdc_ctr4,
106         qry.period_hdc_trn_ctr4))  HRI_P_MEASURE4_MP
107 ,to_char(qry.period_as_of_date,''DD/MM/YYYY'')          HRI_P_CHAR2_GA
108 FROM
109  (' || l_trend_sql || ')  qry
110 WHERE 1=1
111 ' || l_security_clause || '
112 ORDER BY
113   period_order';
114 
115   x_custom_sql := l_sqltext;
116 
117   l_custom_rec.attribute_name := ':TIME_PERIOD_TYPE';
118   l_custom_rec.attribute_value := l_parameter_rec.page_period_type;
119   l_custom_Rec.attribute_type := bis_pmv_parameters_pub.bind_type;
120   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.varchar2_bind;
121   x_custom_output.extend;
122   x_custom_output(1) := l_custom_rec;
123 
124   l_custom_rec.attribute_name := ':TIME_COMPARISON_TYPE';
125   l_custom_rec.attribute_value := l_parameter_rec.time_comparison_type;
126   l_custom_Rec.attribute_type := bis_pmv_parameters_pub.bind_type;
127   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.varchar2_bind;
128   x_custom_output.extend;
129   x_custom_output(2) := l_custom_rec;
130 
131   l_custom_rec.attribute_name := ':TIME_PERIOD_NUMBER';
132   l_custom_rec.attribute_value := l_previous_periods;
133   l_custom_Rec.attribute_type := bis_pmv_parameters_pub.bind_type;
134   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.numeric_bind;
135   x_custom_output.extend;
136   x_custom_output(3) := l_custom_rec;
137 
138   l_custom_rec.attribute_name := ':GEO_COUNTRY_CODE1';
139   l_custom_rec.attribute_value := l_country_tab(1);
140   l_custom_rec.attribute_type := bis_pmv_parameters_pub.bind_type;
141   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.varchar2_bind;
142   x_custom_output.extend;
143   x_custom_output(4) := l_custom_rec;
144 
145   l_custom_rec.attribute_name := ':GEO_COUNTRY_CODE2';
146   l_custom_rec.attribute_value := l_country_tab(2);
147   l_custom_rec.attribute_type := bis_pmv_parameters_pub.bind_type;
148   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.varchar2_bind;
149   x_custom_output.extend;
150   x_custom_output(5) := l_custom_rec;
151 
152   l_custom_rec.attribute_name := ':GEO_COUNTRY_CODE3';
153   l_custom_rec.attribute_value := l_country_tab(3);
154   l_custom_rec.attribute_type := bis_pmv_parameters_pub.bind_type;
155   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.varchar2_bind;
156   x_custom_output.extend;
157   x_custom_output(6) := l_custom_rec;
158 
159   l_custom_rec.attribute_name := ':GEO_COUNTRY_CODE4';
160   l_custom_rec.attribute_value := l_country_tab(4);
161   l_custom_rec.attribute_type := bis_pmv_parameters_pub.bind_type;
162   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.varchar2_bind;
163   x_custom_output.extend;
164   x_custom_output(7) := l_custom_rec;
165 
166   l_custom_rec.attribute_name := ':ANL_FACTOR';
167   l_custom_rec.attribute_value := l_calc_anl_factor;
168   l_custom_rec.attribute_type := bis_pmv_parameters_pub.bind_type;
169   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.numeric_bind;
170   x_custom_output.extend;
171   x_custom_output(8) := l_custom_rec;
172 
173 END get_sql_ctr_t4;
174 
175 /******************************************************************************/
176 /* Annulaized Turnover By Top 10 Countries
177 /******************************************************************************/
178 
179 PROCEDURE GET_SQL_RNK_CTR
180           (p_page_parameter_tbl  IN BIS_PMV_PAGE_PARAMETER_TBL,
181            x_custom_sql          OUT NOCOPY VARCHAR2,
182            x_custom_output       OUT NOCOPY BIS_QUERY_ATTRIBUTES_TBL) IS
183 
184   l_SQLText               VARCHAR2(32767) ;
185   l_custom_rec            BIS_QUERY_ATTRIBUTES;
186   l_security_clause       VARCHAR2(5000);
187 
188 /* Parameter values */
189   l_parameter_rec        hri_oltp_pmv_util_param.HRI_PMV_PARAM_REC_TYPE;
190   l_bind_tab             hri_oltp_pmv_util_param.HRI_PMV_BIND_TAB_TYPE;
191 
192 /* Dynamic SQL Controls */
193   l_wrkfc_params         hri_bpl_fact_sup_wrkfc_sql.wrkfc_fact_param_type;
194   l_wcnt_chg_params      hri_bpl_fact_sup_wcnt_chg_sql.wcnt_chg_fact_param_type;
195   l_wcnt_chg_fact_sql    VARCHAR2(32767);
196   l_wrkfc_fact_sql       VARCHAR2(32767);
197 
198 /* Annualization factor for period type parameter */
199   l_calc_anl_factor         NUMBER;
200 
201 /* Headcount for turnover calc method selected */
202   l_hdc_trn_col_curr        VARCHAR(250);
203   l_hdc_trn_col_comp        VARCHAR(250);
204 
205 /* Drill URL */
206   l_drill_url               VARCHAR(1000);
207 
208 /* Others string */
209   l_others_string           VARCHAR2(240);
210 
211 BEGIN
212 
213 /* Initialize out parameters */
214   l_custom_rec := BIS_PMV_PARAMETERS_PUB.INITIALIZE_QUERY_TYPE;
215   x_custom_output := BIS_QUERY_ATTRIBUTES_TBL();
216 
217 /* Get common parameter values */
218   hri_oltp_pmv_util_param.get_parameters_from_table
219         (p_page_parameter_tbl  => p_page_parameter_tbl,
220          p_parameter_rec       => l_parameter_rec,
221          p_bind_tab            => l_bind_tab);
222 
223 /* Force the View By parameter to Country */
224   l_parameter_rec.view_by := 'GEOGRAPHY+COUNTRY';
225 
226 /* Get security clause for Manager based security */
227   l_security_clause := hri_oltp_pmv_util_pkg.get_security_clause('MGR');
228 
229 /* Get the annualization factor for the different periods */
230   l_calc_anl_factor := hri_oltp_pmv_util_pkg.calc_anl_factor
231                           (p_period_type  => l_parameter_rec.page_period_type);
232 
233 /* Generate the Turnover Fact SQL */
234   l_wcnt_chg_params.bind_format     := 'PMV';
235   l_wcnt_chg_params.include_comp    := 'Y';
236   l_wcnt_chg_params.include_sep     := 'Y';
237   l_wcnt_chg_params.include_sep_inv := 'Y';
238   l_wcnt_chg_params.include_sep_vol := 'Y';
239   l_wcnt_chg_fact_sql := hri_oltp_pmv_query_wcnt_chg.get_sql
240              (p_parameter_rec   => l_parameter_rec,
241               p_bind_tab        => l_bind_tab,
242               p_wcnt_chg_params => l_wcnt_chg_params,
243               p_calling_module  => 'HRI_OLTP_PMV_WMV_TRN_CTR.GET_SQL_RNK_CTR');
244 
245 /* Generate the Workforce Fact SQL */
246   l_wrkfc_params.bind_format   := 'PMV';
247   l_wrkfc_params.include_hdc   := 'Y';
248   l_wrkfc_params.include_comp  := 'Y';
249   l_wrkfc_params.include_start := 'Y';
250   l_wrkfc_fact_sql := hri_oltp_pmv_query_wrkfc.get_sql
251              (p_parameter_rec   => l_parameter_rec,
252               p_bind_tab        => l_bind_tab,
253               p_wrkfc_params    => l_wrkfc_params,
254               p_calling_module  => 'HRI_OLTP_PMV_WMV_TRN_CTR.GET_SQL_RNK_CTR');
255 
256 
257 /* Get the profile value for the turnover calculation */
258   IF fnd_profile.value('HR_TRNVR_CALC_MTHD') = 'WMV_STARTENDAVG' THEN
259     l_hdc_trn_col_curr := '(wmv.curr_hdc_start+wmv.curr_hdc_end)/2';
260     l_hdc_trn_col_comp := '(wmv.comp_hdc_start+wmv.comp_hdc_end)/2';
261   /* Else (Value = Workforce End or Null, which is default ) */
262   ELSE
263     l_hdc_trn_col_curr := 'wmv.curr_hdc_end';
264     l_hdc_trn_col_comp := 'wmv.comp_hdc_end';
265   END IF;
266 
267   l_drill_url := 'pFunctionName=HRI_P_WMV_TRN_SUMMARY_PVT&' ||
268                  'VIEW_BY=HRI_PERSON+HRI_PER_USRDR_H&' ||
269                  'VIEW_BY_NAME=VIEW_BY_ID&' ||
270                  'pParamIds=Y';
271 
272 /* Set Others String */
273   l_others_string := hri_oltp_view_message.get_others_msg;
274 
275 /* Return AK Sql To PMV */
276  l_SQLText    :=
277 'SELECT
278  -- Annualized Turnover By Top x Countries
279  grp.vby_id               VIEWBYID
280 ,DECODE(grp.vby_id, ''NA_OTHERS'', ''' || l_others_string || ''',
281         vby.value)        VIEWBY
282 ,DECODE(grp.vby_id, ''NA_OTHERS'', ''' || l_others_string || ''',
283         vby.value)        HRI_P_CHAR1_GA '|| g_rtn ||
284 /* Title - Headcount */
285 ',grp.curr_hdc_end         HRI_P_MEASURE1 '|| g_rtn ||
286 /* Title - Voluntary  */
287 ',grp.curr_trn_vol         HRI_P_MEASURE2
288 ,:HRI_ANL_FACTOR * 100 * grp.curr_trn_vol / grp.curr_trn_div
289                           HRI_P_MEASURE3 '|| g_rtn ||
290 /* Title -  InVoluntary */
291 ',grp.curr_trn_inv         HRI_P_MEASURE4
292 ,:HRI_ANL_FACTOR * 100 * grp.curr_trn_inv / grp.curr_trn_div
293                           HRI_P_MEASURE5 '|| g_rtn ||
294 /* Title - Total Terms */
295 ',grp.curr_trn_tot         HRI_P_MEASURE6
296 ,:HRI_ANL_FACTOR * 100 * grp.curr_trn_tot / grp.curr_trn_div
297                           HRI_P_MEASURE7 '|| g_rtn ||
298 /* Title - Grand Total Headcount */
299 ',grp.total_curr_hdc_end   HRI_P_GRAND_TOTAL1 '|| g_rtn ||
300 /* Title - Grand Total VOL */
301 ',grp.total_curr_trn_vol   HRI_P_GRAND_TOTAL2
302 ,:HRI_ANL_FACTOR * 100 * grp.total_curr_trn_vol / grp.total_curr_trn_div
303                           HRI_P_GRAND_TOTAL3 '|| g_rtn ||
304 /* Title - Grand Total INVOL */
305 ',grp.total_curr_trn_inv   HRI_P_GRAND_TOTAL4
306 ,:HRI_ANL_FACTOR * 100 * grp.total_curr_trn_inv / grp.total_curr_trn_div
307                           HRI_P_GRAND_TOTAL5 '|| g_rtn ||
308 /* Title - Grand Total TOTAL TERMS */
309 ',grp.total_curr_trn_tot   HRI_P_GRAND_TOTAL6
310 ,:HRI_ANL_FACTOR * 100 * grp.total_curr_trn_tot / grp.total_curr_trn_div
311                           HRI_P_GRAND_TOTAL7
312 ,'''||l_drill_url||'''
313                           HRI_P_DRILL_URL1
314 FROM
315  hri_dbi_cl_geo_country_v  vby,
316  (SELECT' || g_rtn ||
317 /* Bug 4068969 - added country_code and fixed order_by and vby_id */
318 '   DECODE(SIGN(:HRI_NO_COUNTRIES_TO_SHOW - a.rnk),
319             -1, :HRI_NO_COUNTRIES_TO_SHOW + 1,
320           a.rnk)       order_by
321   ,DECODE(SIGN(:HRI_NO_COUNTRIES_TO_SHOW - a.rnk),
322             -1, ''NA_OTHERS'',
323           a.vby_id)            vby_id
324   ,DECODE(SIGN(:HRI_NO_COUNTRIES_TO_SHOW - a.rnk),
325             -1, ''NA_EDW'',
326           a.vby_id)            country_code
327   ,SUM(a.curr_hdc_end)         curr_hdc_end
328   ,SUM(a.total_curr_hdc_end)   total_curr_hdc_end
329   ,SUM(a.curr_trn_vol)         curr_trn_vol
330   ,SUM(a.comp_trn_vol)         comp_trn_vol
331   ,SUM(a.total_curr_trn_vol)   total_curr_trn_vol
332   ,SUM(a.total_comp_trn_vol)   total_comp_trn_vol
333   ,SUM(a.curr_trn_inv)         curr_trn_inv
334   ,SUM(a.comp_trn_inv)         comp_trn_inv
335   ,SUM(a.total_curr_trn_inv)   total_curr_trn_inv
336   ,SUM(a.total_comp_trn_inv)   total_comp_trn_inv
337   ,SUM(a.curr_trn_tot)         curr_trn_tot
338   ,SUM(a.comp_trn_tot)         comp_trn_tot
339   ,SUM(a.total_curr_trn_tot)   total_curr_trn_tot
340   ,SUM(a.total_comp_trn_tot)   total_comp_trn_tot
341   ,SUM(a.curr_trn_div)         curr_trn_div
342   ,SUM(a.comp_trn_div)         comp_trn_div
343   ,SUM(a.total_curr_trn_div)   total_curr_trn_div
344   ,SUM(a.total_comp_trn_div)   total_comp_trn_div
345   FROM
346    (SELECT
347      tots.*' || g_rtn ||
348 /* Bug 4068969 - Ensured ranking function is unique */
349 '    ,RANK() OVER (ORDER BY
350       tots.curr_hdc_end DESC NULLS LAST,
351       tots.vby_id)   rnk ' || g_rtn ||
352 /* Terminations Factor */'
353     ,DECODE(tots.curr_hdc_trn,
354        0, DECODE(tots.curr_trn_tot, 0 , 1, tots.curr_trn_tot),
355      tots.curr_hdc_trn)         curr_trn_div
356     ,DECODE(tots.comp_hdc_trn,
357        0, DECODE(tots.comp_trn_tot, 0 , 1, tots.comp_trn_tot),
358      tots.comp_hdc_trn)         comp_trn_div
359     ,:HRI_ANL_FACTOR            anl_factor ' || g_rtn ||
360 /* Grand Totals - Terminations */ '
361     ,DECODE(tots.total_curr_hdc_trn,
362        0, DECODE(tots.total_curr_trn_tot, 0 , 1, tots.total_curr_trn_tot),
363      tots.total_curr_hdc_trn)   total_curr_trn_div
364     ,DECODE(tots.total_comp_hdc_trn,
365        0, DECODE(tots.total_comp_trn_tot, 0 , 1, tots.total_comp_trn_tot),
366      tots.total_comp_hdc_trn)   total_comp_trn_div
367     FROM
368      (SELECT
369 /* View by */
370        wmv.vby_id ' || g_rtn ||
371 /* Headcount */'
372       ,wmv.curr_hdc_end
373       ,wmv.comp_hdc_end
374       ,DECODE(wmv.comp_hdc_end,
375          0, 0,
376        100 * (wmv.curr_hdc_end - wmv.comp_hdc_end) /
377        wmv.comp_hdc_end)  hdc_change_pct ' || g_rtn ||
378 /* Headcount for turnover calculation */ '
379       ,' || l_hdc_trn_col_curr || '       curr_hdc_trn
380       ,' || l_hdc_trn_col_comp || '       comp_hdc_trn' || g_rtn ||
381 /* Turnover */'
382       ,NVL(trn.curr_sep_vol_hdc, 0)  curr_trn_vol
383       ,NVL(trn.curr_sep_invol_hdc, 0)  curr_trn_inv
384       ,NVL(trn.curr_separation_hdc, 0)  curr_trn_tot
385       ,NVL(trn.comp_sep_vol_hdc, 0)  comp_trn_vol
386       ,NVL(trn.comp_sep_invol_hdc, 0)  comp_trn_inv
387       ,NVL(trn.comp_separation_hdc, 0)  comp_trn_tot ' || g_rtn ||
388 /* Grand Totals - Headcount */ '
389       ,SUM(wmv.curr_hdc_end) OVER ()  total_curr_hdc_end
390       ,SUM(wmv.comp_hdc_end) OVER ()  total_comp_hdc_end ' || g_rtn ||
391 /* Grand Totals - Headcount for turnover calculation */ '
392        ,SUM(' || l_hdc_trn_col_curr || ') OVER ()  total_curr_hdc_trn
393        ,SUM(' || l_hdc_trn_col_comp || ') OVER ()  total_comp_hdc_trn ' || g_rtn ||
394 /* Grand Totals - Turnover */'
395       ,NVL(SUM(trn.curr_sep_vol_hdc) OVER (), 0)  total_curr_trn_vol
396       ,NVL(SUM(trn.curr_sep_invol_hdc) OVER (), 0)  total_curr_trn_inv
397       ,NVL(SUM(trn.curr_separation_hdc) OVER (), 0)  total_curr_trn_tot
398       ,NVL(SUM(trn.comp_sep_vol_hdc) OVER (), 0)  total_comp_trn_vol
399       ,NVL(SUM(trn.comp_sep_invol_hdc) OVER (), 0)  total_comp_trn_inv
400       ,NVL(SUM(trn.comp_separation_hdc) OVER (), 0)  total_comp_trn_tot
401       FROM
402          ( ' || l_wcnt_chg_fact_sql || ' ) trn' || g_rtn
403      || ',( ' || l_wrkfc_fact_sql    || ' ) wmv' || g_rtn
404      || 'WHERE wmv.vby_id = trn.vby_id (+)
405      ) tots
406    ) a
407   WHERE 1 = 1
408   AND (a.curr_hdc_end > 0
409     OR a.curr_trn_vol > 0
410     OR a.curr_trn_inv > 0
411     OR a.comp_trn_vol > 0
412     OR a.comp_trn_inv > 0)
413   GROUP BY
414    DECODE(SIGN(:HRI_NO_COUNTRIES_TO_SHOW - a.rnk),
415             -1, :HRI_NO_COUNTRIES_TO_SHOW + 1,
416           a.rnk)
417   ,DECODE(SIGN(:HRI_NO_COUNTRIES_TO_SHOW - rnk),
418             -1, ''NA_OTHERS'',
419           a.vby_id)
420   ,DECODE(SIGN(:HRI_NO_COUNTRIES_TO_SHOW - rnk),
421             -1, ''NA_EDW'',
422           a.vby_id)
423  ) grp
424 WHERE grp.country_code = vby.id
425 ' || l_security_clause || '
426 ORDER BY grp.order_by';
427 
428  x_custom_sql := l_SQLText;
429 
430 /* Binds Will be inserted Below */
431 
432   x_custom_sql := l_SQLText;
433 
434   l_custom_rec.attribute_name := ':HRI_ANL_FACTOR';
435   l_custom_rec.attribute_value := l_calc_anl_factor;
436   l_custom_Rec.attribute_type := bis_pmv_parameters_pub.bind_type;
437   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.numeric_bind;
438   x_custom_output.extend;
439   x_custom_output(1) := l_custom_rec;
440 
441   l_custom_rec.attribute_name := ':HRI_NO_COUNTRIES_TO_SHOW';
442   l_custom_rec.attribute_value := 10;
443   l_custom_Rec.attribute_type := bis_pmv_parameters_pub.bind_type;
444   l_custom_rec.attribute_data_type := bis_pmv_parameters_pub.numeric_bind;
445   x_custom_output.extend;
446   x_custom_output(2) := l_custom_rec;
447 
448 END GET_SQL_RNK_CTR;
449 
450 END hri_oltp_pmv_wmv_trn_ctr;