The following lines contain the word 'select', 'insert', 'update' or 'delete':
g_select VARCHAR2(3000);
g_select := get_select;
g_query := g_select || ' '|| g_table || ' '|| g_where;
-- update the average, URL
if (g_debug_flag = 'Y') then
biv_core_pkg.biv_debug('Updating Hyperlinks',g_report_code);
UPDATE biv_tmp_hs2
SET col3 = 'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_STS_ID'||g_v_sp||col3||g_p_sp||'P_SEV'||g_v_sp||g_sev_1||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
col7 = 'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_STS_ID'||g_v_sp||col7||g_p_sp||'P_SEV'||g_v_sp||g_sev_2||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
col11 = 'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_STS_ID'||g_v_sp||col11||g_p_sp||'P_SEV'||g_v_sp||g_sev_3||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
col15 = 'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_STS_ID'||g_v_sp||col15||g_p_sp||'P_SEV'||g_v_sp||g_sev_4||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
col19 = 'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_STS_ID'||g_v_sp||col19||g_p_sp||'P_SEV'||g_v_sp||g_sev_5||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
col6 = decode(col4,0,0,round(col6/col4)),
col10 = decode(col8,0,0,round(col10/col8)),
col14 = decode(col12,0,0,round(col14/col12)),
col18 = decode(col16,0,0,round(col18/col16)),
col22 = decode(col20,0,0,round(col22/col20)),
rowno = 1
where session_id = biv_core_pkg.get_session_id;
select attribute_label_long INTO l_total_label
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_6'
and attribute_application_id = 862;
-- insert the total row
INSERT INTO biv_tmp_hs2 (report_code,session_id,col2,
col3,col4,col6,
col7,col8,col10,
col11,col12,col14,
col15,col16,col18,
col19,col20,col22,col24,rowno)
select g_report_code,g_session_id,l_total_label,
'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_SEV'||g_v_sp||g_sev_1||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
nvl(sum(col4),0),
'',
'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_SEV'||g_v_sp||g_sev_2||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
nvl(sum(col8),0),
'',
'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_SEV'||g_v_sp||g_sev_3||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
nvl(sum(col12),0),
'',
'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_SEV'||g_v_sp||g_sev_4||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
nvl(sum(col16),0),
'',
'BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp||'BIV_SERVICE_REQUEST'||g_p_sp||'P_SEV'||g_v_sp||g_sev_5||g_p_sp||'P_BLOG'||g_v_sp||'Y'||g_extra_param,
nvl(sum(col20),0),
'',
'',2 FROM biv_tmp_hs2
where session_id = biv_core_pkg.get_session_id
;
-- build the select statement
FUNCTION get_select RETURN VARCHAR2 IS
l_select_stmt varchar2(3000);
l_select_stmt := '
INSERT INTO biv_tmp_hs2 (report_code,session_id,col2,
col3,col4,col6,
col7,col8,col10,
col11,col12,col14,
col15,col16,col18,
col19,col20,col22,col24)
select :g_report_code ,:session_id,ins.name,
sr.incident_status_id,
sum(decode(sr.incident_severity_id,:g_sev_1_a,1,0)),
sum(decode(sr.incident_severity_id,:g_sev_1_b,sysdate-sr.incident_date,0)),
sr.incident_status_id,
sum(decode(sr.incident_severity_id,:g_sev_2_a,1,0)),
sum(decode(sr.incident_severity_id,:g_sev_2_b,sysdate-sr.incident_date,0)),
sr.incident_status_id,
sum(decode(sr.incident_severity_id,:g_sev_3_a,1,0)),
sum(decode(sr.incident_severity_id,:g_sev_3_b,sysdate-sr.incident_date,0)),
sr.incident_status_id,
sum(decode(sr.incident_severity_id,:g_sev_4_a,1,0)),
sum(decode(sr.incident_severity_id,:g_sev_4_b,sysdate-sr.incident_date,0)),
sr.incident_status_id,
sum(decode(sr.incident_severity_id,:g_sev_5_a,1,0)),
sum(decode(sr.incident_severity_id,:g_sev_5_b,sysdate-sr.incident_date,0)),
(sum(decode(sr.incident_severity_id,:g_sev_1_c,1,0))+
sum(decode(sr.incident_severity_id,:g_sev_2_c,1,0))+
sum(decode(sr.incident_severity_id,:g_sev_3_c,1,0))+
sum(decode(sr.incident_severity_id,:g_sev_4_c,1,0))+
sum(decode(sr.incident_severity_id,:g_sev_5_c,1,0)))
';
return l_select_stmt;
END get_select;
SELECT a.name INTO l_label_1
FROM cs_incident_severities_vl a
WHERE a.incident_severity_id = fnd_profile.value('BIV:INC_SEVERITY_1');
SELECT attribute_label_long INTO l_label_2
FROM ak_attributes_vl
WHERE attribute_application_id = 862
AND attribute_code = 'P_DASH_SR_VIEW_11';
SELECT a.name INTO l_label_1
FROM cs_incident_severities_vl a
WHERE a.incident_severity_id = fnd_profile.value('BIV:INC_SEVERITY_2');
SELECT attribute_label_long INTO l_label_2
FROM ak_attributes_vl
WHERE attribute_application_id = 862
AND attribute_code = 'P_DASH_SR_VIEW_11';
SELECT a.name INTO l_label_1
FROM cs_incident_severities_vl a
WHERE a.incident_severity_id = fnd_profile.value('BIV:INC_SEVERITY_3');
SELECT attribute_label_long INTO l_label_2
FROM ak_attributes_vl
WHERE attribute_application_id = 862
AND attribute_code = 'P_DASH_SR_VIEW_11';
SELECT a.name INTO l_label_1
FROM cs_incident_severities_vl a
WHERE a.incident_severity_id = fnd_profile.value('BIV:INC_SEVERITY_4');
SELECT attribute_label_long INTO l_label_2
FROM ak_attributes_vl
WHERE attribute_application_id = 862
AND attribute_code = 'P_DASH_SR_VIEW_11';
SELECT a.name INTO l_label_1
FROM cs_incident_severities_vl a
WHERE a.incident_severity_id = fnd_profile.value('BIV:INC_SEVERITY_5');
SELECT attribute_label_long INTO l_label_2
FROM ak_attributes_vl
WHERE attribute_application_id = 862
AND attribute_code = 'P_DASH_SR_VIEW_11';