The following lines contain the word 'select', 'insert', 'update' or 'delete':
select attribute_label_long into l_label_m
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_DASH_SR_VIEW_11';
execute immediate ' select description
from cs_incident_severities_vl
where incident_severity_id=:l_check_val' into l_label_s using l_check_val;
select attribute_label_long into l_label_m1
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_SR_SEV_RPT_5';
select attribute_label_long into l_label_m2
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_SR_SEV_RPT_7';
select attribute_label_long into l_label_m3
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_DASH_SR_VIEW_9';
execute immediate ' select name
from cs_incident_statuses_vl
where incident_status_id=:l_check_val' into l_label_s using l_check_val;
select attribute_label_long into l_label_m1
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_SR_SEV_RPT_5';
select attribute_label_long into l_label_m2
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_SR_SEV_RPT_7';
select attribute_label_long into l_label_m3
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_DASH_SR_VIEW_9';
execute immediate ' select name
from cs_incident_statuses_vl
where incident_status_id=:l_check_val' into l_label_s using l_check_val;
select attribute_label_long into l_label_m1
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_SR_SEV_RPT_5';
select attribute_label_long into l_label_m2
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_SR_SEV_RPT_7';
select attribute_label_long into l_label_m3
from ak_attributes_vl
where attribute_application_id = 862
and attribute_code='P_DASH_SR_VIEW_9';
execute immediate ' select name
from cs_incident_statuses_vl
where incident_status_id=:l_check_val' into l_label_s using l_check_val;
select meaning into l_label from fnd_lookups where lookup_type='BIV_VIEW_BY'
and lookup_code=biv_core_pkg.g_view_by;
x_sql_sttmnt:='select ''X'',:x_session, sr.customer_id,count(1)'
||x_from_list||x_where_clause||'
and (nvl(sr.resource_type,''X'') <>''RS_EMPLOYEE'' or sr.incident_owner_id is null )
and nvl(stat.close_flag,''N'') <> ''Y''
group by sr.customer_id';
x_sql_sttmnt:=' select ''X'',:x_session,sr.customer_id,count(1)'
||x_from_list2||x_where_clause2||'
and nvl(stat.close_flag,''N'') <> ''Y''
group by sr.customer_id ';
x_sql_sttmnt:='select ''X'',:x_session,sr.customer_id,count(1)'
||x_from_list||x_where_clause||'
and nvl(stat.close_flag,''N'') <> ''Y''
group by sr.customer_id';
x_sql_sttmnt:=' select ''X'',:x_session,sr.customer_id,count(1)'
||x_from_list1||x_where_clause1||'
and nvl( stat.close_flag,''N'') <>''Y''
group by sr.customer_id ';
x_sql_sttmnt:='insert into biv_tmp_rt1 rep(report_code,session_id, ID,col2)(select * from ( '
||x_sql_sttmnt||' order by 4 desc ) where rownum < :x_display )';
q3_str:='select sr.customer_id a,count(1) b,0 c,0 d,0 e '
||x_from_list||x_where_clause||'
and (nvl(sr.resource_type,''X'') <>''RS_EMPLOYEE'' or sr.incident_owner_id is null)
and nvl(stat.close_flag,''N'') <> ''Y''
and sr.customer_id=rep.ID
and rep.session_id=:x_session group by sr.customer_id';
q4_str:=' select sr.customer_id a,0 b,count(1)c,0 d,0 e '
||x_from_list2||x_where_clause2||'
and sr.customer_id=rep.ID
and nvl(stat.close_flag,''N'') <> ''Y''
and rep.session_id=:x_session group by sr.customer_id ' ;
q5_str:=' select sr.customer_id a, 0 b,0 c,count(1) d, 0 e '
||x_from_list||x_where_clause||'
and nvl(stat.close_flag,''N'') <> ''Y''
and sr.customer_id=rep.ID
and rep.session_id=:x_session group by sr.customer_id' ;
q6_str:='select sr.customer_id a,0 b, 0 c, 0 d,count(1) e '
||x_from_list1||x_where_clause1||'
and nvl( stat.close_flag,''N'') <>''Y''
and sr.customer_id=rep.ID
and rep.session_id=:x_session group by sr.customer_id ';
q3_str:='select ID a,to_number(col2) b ,0 c,0 d,0 e from biv_tmp_rt1 where report_code=''X''
and session_id=:x_session';
q4_str:='select ID a,0 b ,to_number(col2) c,0 d,0 e from biv_tmp_rt1 where report_code=''X''
and session_id=:x_session ';
q5_str:='select ID a,0 b ,0 c,to_number(col2) d,0 e from biv_tmp_rt1 where report_code=''X''
and session_id=:x_session ';
q6_str:='select ID a,0 b ,0 c,0 d,to_number(col2) e from biv_tmp_rt1 where report_code=''X''
and session_id=:x_session ';
x_sql_sttmnt:='insert into biv_tmp_rt1 ( report_code,rowno,session_id,ID,col4,col6,col8,col10)
(select ''BIV_CUSTOMER_BACKLOG'',rownum,ses,ID,col4,col6,col8,col10 from (
(select ''BIV_CUSTOMER_BACKLOG'',:x_session ses, a ID , sum(b) col4, sum(c) col6, sum(d) col8, sum(e) col10 from ('
||q3_str||' union all '||q4_str||' union all '||q5_str||' union all '||q6_str||
') group by a ) order by '||x_order_by||' desc ))';
execute immediate 'delete from biv_tmp_rt1 where report_code=''X'' and session_id=:x_session'
using x_session;
biv_core_pkg.update_description('P_CUST_ID','ID','col2','BIV_TMP_RT1');
update biv_tmp_rt1 rep
set col1=l_new_param_str1||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep,
col3=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_UNOWN'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep||'P_BLOG'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep,
col5=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_ESC_SR'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep||'P_BLOG'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep,
col7=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col9=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_SEV'|| biv_core_pkg.g_value_sep ||
to_char(x_severity_id)||biv_core_pkg.g_param_sep||'P_BLOG'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep,
creation_date = sysdate,
col20 = 'INDV_ROW';
select count(1) into l_ttl_recs
from biv_tmp_rt1
where session_id = x_session
and report_code = 'BIV_CUSTOMER_BACKLOG';
biv_core_pkg.biv_debug('Inserting totol row','BIV_CUSTOMER_BACKLOG');
insert into biv_tmp_rt1(report_code,session_id, rowno,col4,col6,col8,
col10,col20)
select 'BIV_CUSTOMER_BACKLOG',x_session,max(rowno)+1,
sum(col4), sum(col6),
sum(col8), sum(col10),'TTL_ROW'
from biv_tmp_rt1
where session_id = x_session
and report_code = 'BIV_CUSTOMER_BACKLOG'
and col20 = 'INDV_ROW';
update biv_tmp_rt1 rep
set col1=l_new_param_str1 ,
col2=l_ttl_meaning,
col3=l_new_param_str||
'P_UNOWN'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep||'P_BLOG'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep,
col5=l_new_param_str||
'P_ESC_SR'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep||'P_BLOG'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep,
col7=l_new_param_str||
'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col9=l_new_param_str||
'P_SEV'|| biv_core_pkg.g_value_sep ||
to_char(x_severity_id)||biv_core_pkg.g_param_sep||'P_BLOG'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep,
creation_date = sysdate
where col20 = 'TTL_ROW';
x_sql_sttmnt:='select ''X'',:x_session ,'|| biv_core_pkg.g_base_column||' , count(1) '
||x_from_list1||x_where_clause1||'
and sr.incident_severity_id=:x_severity_id
group by '|| biv_core_pkg.g_base_column ;
x_sql_sttmnt:=' select ''X'' ,:x_session ,'|| biv_core_pkg.g_base_column||' , count(1) '
||x_from_list2||x_where_clause2||'
group by '|| biv_core_pkg.g_base_column ;
x_sql_sttmnt:='insert into biv_tmp_rt1 rep(report_code,session_id, ID,col2)(select * from ( '
||x_sql_sttmnt||' order by 4 desc ) where rownum < :x_display )';
q3_str:='(select ''BIV_ESCALATED_SR'',:x_session, ID a ,to_number(col2) b, 0 c ,0 d,0 e,0 f,0 g
from biv_tmp_rt1 where report_code=''X'' and session_id=:x_session )';
q3_str:= '(select ''BIV_ESCALATED_SR'',:x_session ,'|| biv_core_pkg.g_base_column||' a,
count(1) b, 0 c ,0 d,0 e,0 f,0 g '
||x_from_list1||x_where_clause1|| ' and sr.incident_severity_id=:x_severity_id
group by '|| biv_core_pkg.g_base_column||')';
q4_str:= '(select ''BIV_ESCALATED_SR'',:x_session ,'|| biv_core_pkg.g_base_column||' a, 0 b ,
count(1) c ,
sum(decode(sr.incident_status_id,:x_stat_1,1,0)) d ,
sum(decode(sr.incident_status_id,:x_stat_2,1,0)) e ,
sum(decode(sr.incident_status_id,:x_stat_3,1,0)) f,
(count(1)-(sum(decode(sr.incident_status_id,:x_stat_1,1,0))+sum(decode(sr.incident_status_id,:x_stat_2,1,0))+
sum(decode(sr.incident_status_id,:x_stat_3,1,0)))) g '
||x_from_list2||x_where_clause2||
' group by '|| biv_core_pkg.g_base_column||')';
x_sql_sttmnt:= '(select ''BIV_ESCALATED_SR'',rownum ,ses,ID,col4,col6,col8,col10,col12,col14
from (select ''BIV_ESCALATED_SR'',:x_session ses,a ID,sum(b) col4,sum(c) col6,sum(d) col8,
sum(e) col10,sum(f) col12,sum(g) col14 from ('||q3_str ||'
union all '||q4_str||'
) group by a
order by '||x_order_by ||' desc ) where rownum < :x_display)' ;
x_sql_sttmnt:='insert into biv_tmp_rt1 rep (report_code,rowno,session_id,ID,col4,col6,col8,col10,col12,col14)
'||x_sql_sttmnt||' ' ;
execute immediate 'delete from biv_tmp_rt1 where report_code=''X'' and session_id=:x_session'
using x_session;
biv_core_pkg.update_base_col_desc('BIV_TMP_RT1');
update biv_tmp_rt1 rep
set col3=l_new_param_str||
nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_SEV'||
biv_core_pkg.g_value_sep ||to_char(x_severity_id)||
biv_core_pkg.g_param_sep||'P_BLOG'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep,
col5=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_ESC_SR'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep||
'P_BLOG'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep,
col7=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_ESC_SR'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep||
'P_STS_ID'||biv_core_pkg.g_value_sep ||to_char(x_stat_1) ||
biv_core_pkg.g_param_sep ||
'P_BLOG'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep,
col9=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_ESC_SR'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep||
'P_STS_ID'||biv_core_pkg.g_value_sep ||to_char(x_stat_2) ||
biv_core_pkg.g_param_sep ||
'P_BLOG'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep,
col11=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_ESC_SR'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep||
'P_STS_ID'||biv_core_pkg.g_value_sep ||to_char(x_stat_3) ||
biv_core_pkg.g_param_sep ||
'P_BLOG'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep,
col13=l_new_param_str||nvl(to_char(rep.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_ESC_SR'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep||
'P_OTHER_BLOG'||biv_core_pkg.g_value_sep ||'Y' ||
biv_core_pkg.g_param_sep ||
'P_BLOG'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep,
col20='INDV_ROW';
select count(1) into l_ttl_recs
from biv_tmp_rt1
where session_id = x_session
and report_code = 'BIV_ESCALATED_SR';
insert into biv_tmp_rt1(report_code,rowno,col2,col4,col6,col8,col10,
col12, col14, session_id,col20)
select report_code, max(rowno)+1, l_ttl_meaning, sum(col4), sum(col6),
sum(col8), sum(col10), sum(col12), sum(col14), session_id,'TTL_ROW'
from biv_tmp_rt1
where report_code = 'BIV_ESCALATED_SR'
and session_id = x_session
and col20 = 'INDV_ROW'
group by report_code, session_id;
update biv_tmp_rt1 rep
set col3=l_new_param_str||'P_SEV'|| biv_core_pkg.g_value_sep ||
to_char(x_severity_id)||biv_core_pkg.g_param_sep||'P_BLOG'||
biv_core_pkg.g_value_sep || 'Y'||biv_core_pkg.g_param_sep,
col5=l_new_param_str||'P_ESC_SR'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col7=l_new_param_str||'P_ESC_SR'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep ||
'P_STS_ID'||biv_core_pkg.g_value_sep ||to_char(x_stat_1) ||
biv_core_pkg.g_param_sep,
col9=l_new_param_str||'P_ESC_SR'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep ||
'P_STS_ID'||biv_core_pkg.g_value_sep ||to_char(x_stat_2) ||
biv_core_pkg.g_param_sep,
col11=l_new_param_str||'P_ESC_SR'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep ||
'P_STS_ID'||biv_core_pkg.g_value_sep ||to_char(x_stat_3) ||
biv_core_pkg.g_param_sep,
col13=l_new_param_str||'P_ESC_SR'|| biv_core_pkg.g_value_sep || 'Y'||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep ||
'P_OTHER_BLOG'||biv_core_pkg.g_value_sep ||'Y' ||
biv_core_pkg.g_param_sep
where report_code = 'BIV_ESCALATED_SR'
and session_id = x_session
and col20 = 'TTL_ROW';
x_sql_sttmnt:= '(SELECT ''BIV_CUSTOMER_BACKLOG'',rownum, ses, A ,col4,col6,col8,col10 FROM
(select ''BIV_CUSTOMER_BACKLOG'',:x_session ses, A ,sum(B) col4,sum(C)col6,sum(D)col8,sum(E) col10
from (
(select ''BIV_CUSTOMER_BACKLOG'' ,sr.contract_number A ,count(1) B ,0 C,0 D,0 E '
||x_from_list||x_where_clause||'
and (nvl(sr.resource_type,''X'') <>''RS_EMPLOYEE'' or sr.incident_owner_id is null)
and nvl(stat.close_flag,''N'') <> ''Y'' group by sr.contract_number )
union all
(select ''BIV_CUSTOMER_BACKLOG'' ,sr.contract_number A , 0 B ,0 C,count(1) D, 0 E '
||x_from_list||x_where_clause||'
and nvl(stat.close_flag,''N'') <> ''Y'' group by sr.contract_number)
union all
(select ''BIV_CUSTOMER_BACKLOG'' ,sr.contract_number A ,0 B ,0 C, 0 D,count(1) E '
||x_from_list1||x_where_clause1||'
and nvl( stat.close_flag,''N'') <>''Y'' group by sr.contract_number)
union all
(select ''BIV_CUSTOMER_BACKLOG'' ,sr.contract_number A ,0 B ,count(1) C ,0 D ,0 E '
||x_from_list2||x_where_clause2|| ' and nvl( stat.close_flag,''N'') <>''Y''
group by sr.contract_number)) group by A
ORDER BY 3 ))';
x_sql_sttmnt:='insert into biv_tmp_rt1(report_code,rowno,session_id,col2,col4,col6,col8,col10)
'||x_sql_sttmnt||' ' ;
update biv_tmp_rt1
set ID=biv_core_pkg.g_cust_id(1);
update biv_tmp_rt1 d
set col3=l_new_param_str||nvl(to_char(d.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_UNOWN'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep ||'P_CNTR_ID' ||
biv_core_pkg.g_value_sep||nvl(d.col2,biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col5=l_new_param_str||nvl(to_char(d.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_ESC_SR'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep ||'P_CNTR_ID' ||
biv_core_pkg.g_value_sep||nvl(d.col2,biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col7=l_new_param_str||nvl(to_char(d.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep ||'P_CNTR_ID' ||
biv_core_pkg.g_value_sep||nvl(d.col2,biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep,
col9=l_new_param_str||nvl(to_char(d.ID),biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep ||'P_SEV'|| biv_core_pkg.g_value_sep ||
to_char(x_severity_id)||biv_core_pkg.g_param_sep ||'P_CNTR_ID' ||
biv_core_pkg.g_value_sep||nvl(d.col2,biv_core_pkg.g_null)||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col20 = 'INDV_ROW',
creation_date = sysdate;
select count(1) into l_ttl_recs
from biv_tmp_rt1
where session_id = x_session
and report_code = 'BIV_CUSTOMER_BACKLOG';
insert into biv_tmp_rt1 ( report_code,session_id, rowno, col4, col6,
col8, col10, col20)
select 'BIV_CUSTOMER_BACKLOG', x_session, max(rowno)+1,sum(col4),
sum(col6), sum(col8), sum(col10), 'TTL_ROW'
from biv_tmp_rt1
where session_id = x_session
and col20 = 'INDV_ROW'
and report_code = 'BIV_CUSTOMER_BACKLOG';
update biv_tmp_rt1 d
set col3=l_new_param_str||
'P_UNOWN'|| biv_core_pkg.g_value_sep ||
'Y'||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col5=l_new_param_str||
'P_ESC_SR'|| biv_core_pkg.g_value_sep ||
'Y'||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col7=l_new_param_str||
'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||
biv_core_pkg.g_param_sep,
col9=l_new_param_str||
'P_SEV'|| biv_core_pkg.g_value_sep ||
to_char(x_severity_id)||
biv_core_pkg.g_param_sep||'P_BLOG'|| biv_core_pkg.g_value_sep ||
'Y'||biv_core_pkg.g_param_sep,
col2=l_ttl_meaning,
creation_date = sysdate
where session_id = x_session
and col20 = 'TTL_ROW'
and report_code = 'BIV_CUSTOMER_BACKLOG';