The following lines contain the word 'select', 'insert', 'update' or 'delete':
'SELECT -- Turnover with Performance Band Trend
qry.period_as_of_date VIEWBYID
,qry.period_as_of_date VIEWBY
,qry.period_order HRI_P_ORDER_BY_1
,DECODE(qry.period_sep_hdc, 0, 0,
(qry.period_sep_hdc_b3/qry.period_sep_hdc)*100)
HRI_P_MEASURE1
,DECODE(qry.period_sep_hdc, 0, 0,
(qry.period_sep_hdc_b2/qry.period_sep_hdc)*100)
HRI_P_MEASURE2
,DECODE(qry.period_sep_hdc, 0, 0,
(qry.period_sep_hdc_b1/qry.period_sep_hdc)*100)
HRI_P_MEASURE3
,DECODE(qry.period_sep_hdc, 0, 0,
(qry.period_sep_hdc_na/qry.period_sep_hdc)*100)
HRI_P_MEASURE4
,to_char(qry.period_as_of_date, ''DD/MM/YYYY'')
HRI_P_CHAR1_GA
FROM
(' || l_trend_sql || ') qry
WHERE 1=1
' || l_security_clause || '
ORDER BY qry.period_order';
'SELECT -- Terminations by Job Function (Top 5)
qry.vby_id VIEWBYID
,DECODE(qry.grp_id,
''NA_OTHERS'', ''' || hri_oltp_view_message.get_others_msg || ''',
cl.value) VIEWBY
,qry.curr_separation_hdc HRI_P_MEASURE1
,DECODE(qry.grp_id, ''NA_OTHERS'', '''', ''' || l_drill_url1 || ''')
HRI_P_DRILL_URL1
,qry.comp_separation_hdc HRI_P_MEASURE2
,DECODE(qry.comp_separation_hdc, 0, NULL,
100 * (qry.curr_separation_hdc - qry.comp_separation_hdc) /
qry.comp_separation_hdc)
HRI_P_MEASURE1_MP
FROM
' || hri_mtdt_dim_lvl.g_dim_lvl_mtdt_tab
(l_parameter_rec.view_by).viewby_table || ' cl
,(SELECT' || g_rtn ||
/* Bug 4068969 - added grp_id and corrected logic for vby_id and order_by */
' DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnk),
-1, :HRI_NO_SEGMENTS_TO_SHOW + 1,
rnk) order_by
,DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnk),
-1, ''NA_EDW'',
rnked_metrics.vby_id) vby_id
,DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnk),
-1, ''NA_OTHERS'',
rnked_metrics.vby_id) grp_id
,SUM(rnked_metrics.curr_separation_hdc) curr_separation_hdc
,SUM(rnked_metrics.comp_separation_hdc) comp_separation_hdc
FROM
(SELECT
cube.vby_id
,cube.curr_separation_hdc
,cube.comp_separation_hdc' || g_rtn ||
/* Bug 3068969 - Order by descending terminations (curr and prev) to prevent */
/* outermost filter removing ranked lines and still displaying OTHERS */
' ,RANK() OVER (ORDER BY cube.curr_separation_hdc DESC NULLS LAST,
cube.comp_separation_hdc DESC NULLS LAST,
cube.vby_id) AS RNK
FROM
(' || l_wcnt_chg_fact_sql || ') cube
) rnked_metrics
GROUP BY
DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnk),
-1, :HRI_NO_SEGMENTS_TO_SHOW + 1,
rnk)
,DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnk),
-1, ''NA_EDW'',
rnked_metrics.vby_id)
,DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnk),
-1, ''NA_OTHERS'',
rnked_metrics.vby_id)
) qry
WHERE qry.vby_id = cl.id
AND (qry.curr_separation_hdc + qry.comp_separation_hdc) > 0 ' || g_rtn
|| l_security_clause || g_rtn
|| 'ORDER BY qry.order_by';
/* Binds Will be inserted Below */
l_custom_rec.attribute_name := ':HRI_NO_SEGMENTS_TO_SHOW';
'SELECT
-- Terminations by Leaving Reason (Top 5)
qry.vby_id VIEWBYID
,DECODE(qry.grp_id,
''NA_OTHERS'', ''' || hri_oltp_view_message.get_others_msg || ''',
cl.value) VIEWBY
,qry.curr_separation_hdc HRI_P_MEASURE1
,DECODE(qry.grp_id, ''NA_OTHERS'', '''', ''' || l_drill_url1 ||''')
HRI_P_DRILL_URL1
,qry.comp_separation_hdc HRI_P_MEASURE2
,DECODE(qry.curr_separation_hdc, 0, NULL,
((qry.curr_separation_hdc - qry.comp_separation_hdc) /
qry.curr_separation_hdc) * 100)
HRI_P_MEASURE1_MP
FROM
' || hri_mtdt_dim_lvl.g_dim_lvl_mtdt_tab
(l_parameter_rec.view_by).viewby_table || ' cl
,(SELECT' || g_rtn ||
/* Bug 4068969 - added grp_id and corrected logic for vby_id and order_by */
' DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnked_metrics.rnk),
-1, :HRI_NO_SEGMENTS_TO_SHOW + 1,
rnk) order_by
,DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnked_metrics.rnk),
-1, ''NA_EDW'',
rnked_metrics.vby_id) vby_id
,DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnked_metrics.rnk),
-1, ''NA_OTHERS'',
rnked_metrics.vby_id) grp_id
,SUM(rnked_metrics.curr_separation_hdc) curr_separation_hdc
,SUM(rnked_metrics.comp_separation_hdc) comp_separation_hdc
FROM
(SELECT
cube.vby_id
,cube.curr_separation_hdc
,cube.comp_separation_hdc' || g_rtn ||
/* Bug 3068969 - Order by descending terminations (curr and prev) to prevent */
/* outermost filter removing ranked lines and still displaying OTHERS */
' ,RANK() OVER (ORDER BY cube.curr_separation_hdc DESC NULLS LAST,
cube.comp_separation_hdc DESC NULLS LAST,
cube.vby_id) AS RNK
FROM
(' || l_wcnt_chg_fact_sql || ') cube
) RNKED_METRICS
GROUP BY
DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnked_metrics.rnk),
-1, :HRI_NO_SEGMENTS_TO_SHOW + 1,
rnk)
,DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnked_metrics.rnk),
-1, ''NA_EDW'',
rnked_metrics.vby_id)
,DECODE(SIGN(:HRI_NO_SEGMENTS_TO_SHOW - rnked_metrics.rnk),
-1, ''NA_OTHERS'',
rnked_metrics.vby_id)
) QRY
WHERE qry.vby_id = cl.id
AND (qry.curr_separation_hdc + qry.comp_separation_hdc) > 0' || g_rtn
|| l_security_clause || g_rtn ||
'ORDER BY qry.order_by';
/* Binds Will be inserted Below */
l_custom_rec.attribute_name := ':HRI_NO_SEGMENTS_TO_SHOW';