The following lines contain the word 'select', 'insert', 'update' or 'delete':
'SELECT -- Workforce Summary Portlet (Gen)
a.id VIEWBYID
,a.value VIEWBY
,DECODE(a.direct_ind , 0, ''Y'', ''N'') DRILLPIVOTVB
,a.curr_hdc_end HRI_P_MEASURE1
,a.hdc_change_pct HRI_P_MEASURE1_MP
,DECODE(a.curr_total_hdc_end, 0, 0,
(100 * a.curr_hdc_end) / a.curr_total_hdc_end) ' ||
'HRI_P_MEASURE2
,a.comp_hdc_end HRI_P_MEASURE3
,a.curr_sal_end HRI_P_MEASURE4
,a.sal_change_pct HRI_P_MEASURE4_MP
,DECODE(a.curr_total_sal_end, 0, 0,
100 * a.curr_sal_end / a.curr_total_sal_end) HRI_P_MEASURE5
,a.comp_sal_end HRI_P_MEASURE6
,a.curr_avg_sal HRI_P_MEASURE7
,' || hri_oltp_pmv_util_pkg.get_change_percent_sql
(p_previous_col => 'a.comp_avg_sal',
p_current_col => 'a.curr_avg_sal') || '
HRI_P_MEASURE7_MP
,a.comp_avg_sal HRI_P_MEASURE8
,a.anl_factor * 100 * a.curr_trn_vol / a.curr_trn_div HRI_P_MEASURE9
,a.anl_factor * 100 * a.curr_trn_inv / a.curr_trn_div HRI_P_MEASURE10
,a.anl_factor * 100 * a.curr_trn_tot / a.curr_trn_div HRI_P_MEASURE11
,a.anl_factor * 100 * (a.curr_trn_tot / a.curr_trn_div -
a.comp_trn_tot / a.comp_trn_div) HRI_P_MEASURE11_MP
,a.curr_trn_vol HRI_P_MEASURE12
,a.curr_trn_inv HRI_P_MEASURE13
,a.curr_trn_tot HRI_P_MEASURE14
,DECODE(a.curr_total_trn_tot, 0, 0,
100 * a.curr_trn_tot / a.curr_total_trn_tot) HRI_P_MEASURE15
,a.curr_total_hdc_end HRI_P_GRAND_TOTAL1
,' || hri_oltp_pmv_util_pkg.get_change_percent_sql
(p_previous_col => 'a.comp_total_hdc_end',
p_current_col => 'a.curr_total_hdc_end') || '
HRI_P_GRAND_TOTAL1_MP
,100 HRI_P_GRAND_TOTAL2
,a.comp_total_hdc_end HRI_P_GRAND_TOTAL3
,a.curr_total_sal_end HRI_P_GRAND_TOTAL4
,' || hri_oltp_pmv_util_pkg.get_change_percent_sql
(p_previous_col => 'a.comp_total_sal_end',
p_current_col => 'a.curr_total_sal_end') || '
HRI_P_GRAND_TOTAL4_MP
,100 HRI_P_GRAND_TOTAL5
,a.comp_total_sal_end HRI_P_GRAND_TOTAL6
,a.curr_total_avg_sal HRI_P_GRAND_TOTAL7
,' || hri_oltp_pmv_util_pkg.get_change_percent_sql
(p_previous_col => 'a.comp_total_avg_sal',
p_current_col => 'a.curr_total_avg_sal') || '
HRI_P_GRAND_TOTAL7_MP
,a.comp_total_avg_sal HRI_P_GRAND_TOTAL8
,a.anl_factor * 100 * a.curr_total_trn_vol / curr_total_trn_div HRI_P_GRAND_TOTAL9
,a.anl_factor * 100 * a.curr_total_trn_inv / curr_total_trn_div HRI_P_GRAND_TOTAL10
,a.anl_factor * 100 * a.curr_total_trn_tot / curr_total_trn_div HRI_P_GRAND_TOTAL11
,a.anl_factor * 100 * (a.curr_total_trn_tot / curr_total_trn_div -
a.comp_total_trn_tot / comp_total_trn_div) HRI_P_GRAND_TOTAL11_MP' || g_rtn ||
/* Order by person name default sort order */
',a.order_by HRI_P_ORDER_BY_1 ' || g_rtn ||
/* Whether the row is a supervisor rollup row */
',DECODE(a.direct_ind , 0, '''', ''N'') HRI_P_SUPH_RO_CA' || g_rtn ||
/* Drill URLs */
',DECODE(a.direct_ind,
0, ''' || l_dynsql_rec.drill_mgr_sup || ''',
1, ''' || l_dynsql_rec.drill_to_detail || ''',
'''') HRI_P_DRILL_URL1
FROM
(SELECT
tots.* ' || g_rtn ||
/* Headcount */
' ,' || hri_oltp_pmv_util_pkg.get_change_percent_sql
(p_previous_col => 'tots.comp_hdc_end',
p_current_col => 'tots.curr_hdc_end') || '
hdc_change_pct' || g_rtn ||
/* Salary */
' ,' || hri_oltp_pmv_util_pkg.get_change_percent_sql
(p_previous_col => 'tots.comp_sal_end',
p_current_col => 'tots.curr_sal_end') || '
sal_change_pct' || g_rtn ||
/* Average Salary */
' ,DECODE(tots.curr_hdc_end,
0, to_number(null),
tots.curr_sal_end / tots.curr_hdc_end) curr_avg_sal
,DECODE(tots.comp_hdc_end,
0, to_number(null),
tots.comp_sal_end / tots.comp_hdc_end) comp_avg_sal
,DECODE(tots.curr_hdc_trn,
0, DECODE(tots.curr_trn_tot, 0 , 1, tots.curr_trn_tot),
tots.curr_hdc_trn) curr_trn_div
,DECODE(tots.comp_hdc_trn,
0, DECODE(tots.comp_trn_tot, 0 , 1, tots.comp_trn_tot),
tots.comp_hdc_trn) comp_trn_div
,:HRI_ANL_FACTOR anl_factor' || g_rtn ||
/* Grand Totals - Average Salary */
',DECODE(tots.curr_total_hdc_end,
0, to_number(null),
tots.curr_total_sal_end / tots.curr_total_hdc_end) curr_total_avg_sal
,DECODE(tots.comp_total_hdc_end,
0, to_number(null),
tots.comp_total_sal_end / tots.comp_total_hdc_end) comp_total_avg_sal
,DECODE(tots.curr_total_hdc_trn,
0, DECODE(tots.curr_total_trn_tot, 0 , 1, tots.curr_total_trn_tot),
tots.curr_total_hdc_trn) curr_total_trn_div
,DECODE(tots.comp_total_hdc_trn,
0, DECODE(tots.comp_total_trn_tot, 0 , 1, tots.comp_total_trn_tot),
tots.comp_total_hdc_trn) comp_total_trn_div
FROM
(SELECT
/* View by */
vby.id
,DECODE(wmv.direct_ind,
1, ''' || l_direct_reports_string || ''',
vby.value) value
,to_char(NVL(wmv.direct_ind, 0)) || vby.order_by order_by' || g_rtn ||
/* Indicators */
' ,NVL(wmv.direct_ind, 0) direct_ind' || g_rtn ||
/* Headcount */
' ,NVL(wmv.curr_hdc_end, 0) curr_hdc_end
,NVL(wmv.comp_hdc_end, 0) comp_hdc_end' || g_rtn ||
/* Salary */
' ,NVL(wmv.curr_sal_end, 0) curr_sal_end
,NVL(wmv.comp_sal_end, 0) comp_sal_end' || g_rtn ||
/* Headcount for turnover calculation */
' ,' || l_dynsql_rec.hdc_trn_col_curr ||
' curr_hdc_trn
,' || l_dynsql_rec.hdc_trn_col_comp ||
' comp_hdc_trn' || g_rtn ||
/* Turnover */
' ,NVL(trn.curr_sep_vol_hdc, 0) curr_trn_vol
,NVL(trn.curr_sep_invol_hdc, 0) curr_trn_inv
,NVL(trn.curr_separation_hdc, 0) curr_trn_tot
,NVL(trn.comp_sep_vol_hdc, 0) comp_trn_vol
,NVL(trn.comp_sep_invol_hdc, 0) comp_trn_inv
,NVL(trn.comp_separation_hdc, 0) comp_trn_tot' || g_rtn ||
/* Grand Totals - Headcount */
' ,NVL(SUM(wmv.curr_hdc_end) OVER (), 0) curr_total_hdc_end
,NVL(SUM(wmv.comp_total_hdc_end) OVER (), 0) comp_total_hdc_end' || g_rtn ||
/* Grand Totals - Salary */
' ,NVL(SUM(wmv.curr_sal_end) OVER (), 0) curr_total_sal_end
,NVL(SUM(wmv.comp_total_sal_end) OVER (), 0) comp_total_sal_end' || g_rtn ||
/* Grand Totals - Headcount for turnover calculation */
' ,NVL(SUM(' || l_dynsql_rec.hdc_trn_col_curr_tot ||
') OVER (), 0) curr_total_hdc_trn
,NVL(SUM(' || l_dynsql_rec.hdc_trn_col_comp_tot ||
') OVER (), 0) comp_total_hdc_trn' || g_rtn ||
/* Grand Totals - Turnover */
' ,:HRI_CURR_TRN_VOL curr_total_trn_vol
,:HRI_CURR_TRN_INVOL curr_total_trn_inv
,:HRI_CURR_TRN_INVOL + :HRI_CURR_TRN_VOL curr_total_trn_tot
,:HRI_COMP_TRN_VOL comp_total_trn_vol
,:HRI_COMP_TRN_INVOL comp_total_trn_inv
,:HRI_COMP_TRN_VOL + :HRI_COMP_TRN_INVOL comp_total_trn_tot
FROM
' || hri_mtdt_dim_lvl.g_dim_lvl_mtdt_tab
(l_parameter_rec.view_by).viewby_table || ' vby,
(' || l_wcnt_chg_fact_sql || ') trn,
(' || l_wrkfc_fact_sql || ') wmv
WHERE wmv.vby_id = trn.vby_id (+)
AND wmv.vby_id ' || l_dynsql_rec.wrkfc_outer_join || ' = vby.id' || g_rtn ||
l_dynsql_rec.viewby_condition ||
' ) tots
) a
WHERE 1 = 1 ' || g_rtn ||
l_dynsql_rec.display_row_condition ||
l_security_clause || '
ORDER BY a.direct_ind, ' || l_dynsql_rec.order_by;