The following lines contain the word 'select', 'insert', 'update' or 'delete':
l_select VARCHAR2(500);
l_select := 'INSERT INTO biv_tmp_bin (report_code, session_id, col2, col3, col4) ';
l_select := l_select || 'SELECT :report_id,:session_id,stat.name, ';
l_select := l_select || '''BIV_SERVICE_REQUEST';
/* Parameters being added to l_url rather than l_select to accomadate
enhancement 2914005
*/
if l_ogrp is not null then
l_url := l_url || g_p_sp || 'P_OGRP' || g_v_sp || l_ogrp;
l_select := l_select || l_url || g_p_sp || 'P_STS_ID' || g_v_sp;
l_select := l_select || '''||stat.incident_status_id||''' || g_p_sp || '''';
l_select := l_select || ',count(sr.incident_id) ';
l_query := l_select || ' ' || l_table || ' ' || l_where;
insert into biv_tmp_bin (report_code,session_id,col2,col4,col3) select biv_core_pkg.g_report_id,biv_core_pkg.get_session_id,
l_total,decode(sum(col4),null,0,sum(col4)),l_totalurl from biv_tmp_bin;
l_select VARCHAR2(1000);
l_select := 'INSERT INTO biv_tmp_rt1(report_code,session_id,col2, col3, col4, ';
l_select := l_select || 'col5, col6, col7, col8,col20) ';
l_select := l_select || 'SELECT :l_report_code,:x_session_id,stat.name, ';
l_select := l_select || '''BIV_RT_SR_SEV' || g_p_sp || 'jtfBinId';
l_select := l_select || g_v_sp || 'BIV_RT_SR_SEV' || g_p_sp;
l_select := l_select || 'P_CHNL' || g_v_sp || 'WEB' || g_p_sp;
l_select := l_select || 'P_STS_ID' || g_v_sp || '''||';
l_select := l_select || 'stat.incident_status_id||'''||l_url_param||''', ';
l_select := l_select || 'sum(decode(upper(sr.sr_creation_channel),''WEB'',1,0)), ';
l_select := l_select || '''BIV_RT_SR_SEV' || g_p_sp || 'jtfBinId';
l_select := l_select || g_v_sp || 'BIV_RT_SR_SEV' || g_p_sp;
l_select := l_select || 'P_CHNL' || g_v_sp || 'PHONE' || g_p_sp;
l_select := l_select || 'P_STS_ID' || g_v_sp || '''||';
l_select := l_select || 'stat.incident_status_id||'''||l_url_param||''', ';
l_select := l_select || 'sum(decode(upper(sr.sr_creation_channel),''PHONE'',1,0)), ';
l_select := l_select || '''BIV_RT_SR_SEV' || g_p_sp || 'jtfBinId';
l_select := l_select || g_v_sp || 'BIV_RT_SR_SEV' || g_p_sp;
l_select := l_select || 'P_ESC_SR' || g_v_sp || 'Y' || g_p_sp;
l_select := l_select || 'P_STS_ID' || g_v_sp || '''||';
l_select := l_select || 'stat.incident_status_id||'''||l_url_param||''', ';
l_select := l_select || 'biv_dash_bin_pkg.get_esc_sr_backlog(1,stat.incident_status_id) ,''INDV_ROW''';
g_esc_sel_stt := 'select count(sr.incident_id)
' || g_esc_frm_lst || g_esc_whr_cls;
l_query := l_select || ' ' || l_table || ' '|| l_where;
select count(*) into l_ttl_recs
from biv_tmp_rt1
where report_code = l_report_code
and session_id = g_session_id;
biv_core_pkg.biv_debug('going to insert total row',
l_report_code);
insert into biv_tmp_rt1 (report_code,session_id,
col2,col4,col6,col8,col20,
col3, col5, col7)
select l_report_code, g_session_id, l_ttl_meaning, sum(col4),
sum(col6), sum(col8), 'TTL_ROW',
l_param_str || 'P_CHNL' || g_v_sp || 'WEB',
l_param_str || 'P_CHNL' || g_v_sp || 'PHONE',
l_param_str || 'P_ESC_SR' || g_v_sp || 'Y'
from biv_tmp_rt1
where report_code = l_report_code
and session_id = g_session_id;
l_select VARCHAR2(1000);
l_select := l_select || 'INSERT INTO biv_tmp_rt1(report_code,session_id,col2,col3,col4,col5,col6) ';
l_select := l_select || 'select :l_report_code,:g_session_id,c.NAME, ';
l_select := l_select || '''BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp;
l_select := l_select || 'BIV_SERVICE_REQUEST';
l_select := l_select || g_p_sp||'P_ESC_SR'||g_v_sp||'Y'||g_p_sp||'P_STS_ID'||g_v_sp;
l_select := l_select || l_status||g_p_sp||'P_SEV'||g_v_sp||'''||c.incident_severity_id||'''||l_url_param||''', ';
l_select := l_select || ' count(sr.incident_id),';
l_select := l_select || '''BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp;
l_select := l_select || 'BIV_SERVICE_REQUEST';
l_select := l_select || g_p_sp||'P_ESC_SR'||g_v_sp||'Y'||g_p_sp||'P_STS_ID'||g_v_sp;
l_select := l_select || l_status||g_p_sp||'P_SEV'||g_v_sp||'''||c.incident_severity_id||'''||l_url_param||''', ';
l_select := l_select || 'BIV_DASH_BIN_PKG.get_hours(min(sr.incident_date)) ';
l_select := l_select || 'INSERT INTO biv_tmp_rt1(report_code,session_id,col2,col3,col4,col5,col6) ';
l_select := l_select || 'select :l_report_code,:g_session_id,c.NAME, ';
l_select := l_select || '''BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp;
l_select := l_select || 'BIV_SERVICE_REQUEST';
l_select := l_select || g_p_sp||'P_CHNL'||g_v_sp||l_channel||g_p_sp||'P_STS_ID'||g_v_sp;
l_select := l_select || l_status||g_p_sp||'P_SEV'||g_v_sp||'''||c.incident_severity_id||'''||l_url_param||''', ';
l_select := l_select || ' count(sr.incident_id), ';
l_select := l_select || '''BIV_SERVICE_REQUEST'||g_p_sp||'jtfBinId'||g_v_sp;
l_select := l_select || 'BIV_SERVICE_REQUEST';
l_select := l_select || g_p_sp||'P_CHNL'||g_v_sp||l_channel||g_p_sp||'P_STS_ID'||g_v_sp;
l_select := l_select || l_status||g_p_sp||'P_SEV'||g_v_sp||'''||c.incident_severity_id||'''||l_url_param||''', ';
l_select := l_select || 'BIV_DASH_BIN_PKG.get_hours(min(sr.incident_date)) ';
l_query := l_select || ' ' || l_table || ' '|| l_where;
select attribute_label_long into l_report_name
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_1';
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_3';
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_4';
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_5';
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_2';
SELECT name INTO l_tmp
FROM cs_incident_statuses_vl
WHERE incident_status_id = to_number(l_status);
select attribute_label_long into l_label
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_6';
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_3';
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_4';
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_5';
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_7';
SELECT name INTO l_tmp
FROM cs_incident_statuses_vl
WHERE incident_status_id = to_number(l_status);
select attribute_label_long into l_tmp
from ak_attributes_vl
where attribute_code = 'P_SR_SEV_RPT_8';
select count(ina.incident_id) into x_val
FROM
cs_incidents_all_b ina,
jtf_task_references_b r, jtf_tasks_b t
WHERE ina.incident_id = r.object_id
and r.task_id = t.task_id
and r.object_type_code = 'SR'
and r.reference_code = 'ESC'
and t.task_type_id = 22
and t.escalation_level is not null
and ina.incident_status_id = p_status;
select decode(count(*),0,'N','Y') into x_esc_flag
from jtf_task_references_b r,jtf_tasks_b t
where r.OBJECT_ID = p_sr_id
and r.object_type_code = 'SR'
and r.reference_code = 'ESC'
and r.task_id = t.task_id
and t.task_type_id = 22;