The following lines contain the word 'select', 'insert', 'update' or 'delete':
/* Form the SQL string to insert the rows into the temp table */
g_sqlstmt := '
INSERT /*+ PARALLEL(tr,2) */ INTO bix_dm_report tr (
session_id
, report_code
, col1
, col2
, col3
, col4
, col5
, col6
, col8
, col10
, col12
, col14
, col16
, col18
, col20
, col22
, col24
, col26
, col28
, col30 )
(SELECT /*+ PARALLEL(a,2) */
:session_id
, ''BIX_CALLS_TYPE_RPT'' ';
/* This procedure forms and executes the SQL statement that inserts the */
/* detail rows corresponding o the classification in the table bix_dm_report */
PROCEDURE insert_detail_rows(p_classification_id IN NUMBER)
IS
BEGIN
/* Form and execute the SQL statement to insert into the temp table */
/* the detail rows coreesponding to the classification p_classification_id */
form_sqlstmt(FALSE, p_classification_id);
END insert_detail_rows;
/* This procedure forms and executes the SQL statement that inserts the */
/* total row corresponding o the classification in the table bix_dm_report */
PROCEDURE insert_total_rows(p_classification_id IN NUMBER)
IS
BEGIN
/* Form and execute the SQL statement to insert into the temp table */
/* the total rows coreesponding to the classifications p_classification_id */
form_sqlstmt(TRUE, p_classification_id);
END insert_total_rows;
SELECT MAX(period_start_date)
INTO l_temp_date
FROM bix_dm_agent_call_sum;
/* Period Indicator = 7 indicates that user has selected today as reporting period */
g_from_date := to_date(to_char(g_sysdate, 'dd/mm/yyyy') || ' 00:00:00','dd/mm/yyyy hh24:mi:ss');
/* Period Indicator = 8 indicates that user has selected yesterday as reporting period */
g_from_date := to_date(to_char(g_sysdate-1, 'dd/mm/yyyy') || ' 00:00:00','dd/mm/yyyy hh24:mi:ss');
SELECT icx_sec.g_session_id
INTO g_session_id
FROM dual;
/* Delete the rows from the table bix_dm_report for the current icx session and report */
/* so that we donot display the leftover rows from the previous execution of the report */
DELETE bix_dm_report
WHERE report_code = 'BIX_CALLS_TYPE_RPT'
AND session_id = g_session_id;
SELECT sysdate
INTO g_sysdate
FROM dual;
SELECT fnd_profile.value('BIX_DM_RPT_TIME_RANGE')
INTO g_time_range
FROM dual;
/* Insert the total rows corresponding to the classification */
IF (g_classification_param IS NOT NULL) THEN
insert_total_rows(to_number(g_classification_param));
insert_total_rows(to_number(substr(g_classification_parent, 1, length(g_classification_parent)-1)));
/* Update the temp table so that next time the user clicked on the */
/* same classification we donot display the detail rows again */
UPDATE bix_dm_report
SET col1 = to_char(l_classification_id) || 'n'
WHERE col1 = to_char(l_classification_id) || 'y'
AND report_code = 'BIX_CALLS_TYPE_RPT'
AND session_id = g_session_id;
/* summary table and insert them into bix temp table */
insert_detail_rows(l_classification_id);