The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE update_master_status(p_request_id IN NUMBER, p_source IN VARCHAR2, p_log_status IN VARCHAR2, p_status_check_clause IN VARCHAR2, p_id_list IN typ_nest_tab_number);
PROCEDURE update_status(p_request_id IN NUMBER, p_source IN VARCHAR2) IS
v_current_id NUMBER := 2;
l_api_name constant VARCHAR2(70) := 'update_status : ';
SELECT MAX(id)
INTO v_last_commit_marker_id
FROM az_diff_results
WHERE request_id = p_request_id
AND source = p_source
AND name = v_commit_marker_name
ORDER BY id;
DELETE FROM az_diff_results
WHERE request_id = p_request_id
AND source = p_source
AND name = v_commit_marker_name;
UPDATE az_diff_results
SET detail_log_status = 'SP'
WHERE request_id = p_request_id
AND source = p_source
AND id > v_last_commit_marker_id
AND detail_log_status IN('I', 'U', 'IW', 'UW')
AND detail_log_status <> 'SP';
SELECT id bulk collect
INTO v_commit_marker_id_list
FROM az_diff_results
WHERE request_id = p_request_id
AND source = p_source
AND detail_log_status = 'SW'
ORDER BY id;
update_master_status(p_request_id, p_source, 'concat(g.detail_log_status,''W'')', ' not in (''IW'',''UW'',''SW'')', v_commit_marker_id_list);
SELECT id bulk collect
INTO v_commit_marker_id_list
FROM az_diff_results
WHERE request_id = p_request_id
AND source = p_source
AND detail_log_status = 'E'
ORDER BY id;
update_master_status(p_request_id, p_source, '''SE''', ' not in (''E'',''SE'')', v_commit_marker_id_list);
raise_error_msg(SQLCODE, sqlerrm, 'update_status', 'procedure end');
END update_status;
PROCEDURE update_master_status(p_request_id IN NUMBER, p_source IN VARCHAR2, p_log_status IN VARCHAR2, p_status_check_clause IN VARCHAR2, p_id_list IN typ_nest_tab_number) IS
l_api_name constant VARCHAR2(30) := 'update_master_status : ';
l_log_query := 'UPDATE az_diff_results g
SET g.detail_log_status = ' || p_log_status || '
WHERE g.id in
(SELECT k.id
FROM
(SELECT parent_id, id, detail_log_status
FROM
(SELECT d.parent_id, d.id, d.detail_log_status
FROM az_diff_results d
WHERE d.request_id = ' || p_request_id || '
AND d.source = ''' || p_source || '''
AND d.parent_id >0) f
CONNECT BY PRIOR f.parent_id = f.id START WITH f.id = ' || p_id_list(i) || ') k
WHERE (k.detail_log_status ' || p_status_check_clause || '))
AND g.request_id = ' || p_request_id || '
AND g.source = ''' || p_source || '''';
|| to_char(systimestamp), 'Executing update master status query: ' || l_log_query);
END update_master_status;
PROCEDURE update_det_log_counts(p_request_id IN NUMBER, p_source IN VARCHAR2, p_update_xsl OUT nocopy VARCHAR2) IS
v_diff_type_list typ_nest_tab_varchar;
v_update_xsl VARCHAR2(32767);
l_api_name constant VARCHAR2(50) := 'update_det_log_counts : ';
v_update_xsl := '';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
SELECT COUNT(1)
INTO v_rows_count
FROM az_diff_results d
WHERE request_id = p_request_id
AND source = p_source
AND parent_id = 1
AND detail_log_status = 'I';
v_update_xsl := v_update_xsl || '
v_update_xsl := v_update_xsl || p_source || ''']">';
v_update_xsl := v_update_xsl || v_rows_count || '';
SELECT COUNT(1)
INTO v_rows_count
FROM az_diff_results d
WHERE request_id = p_request_id
AND source = p_source
AND parent_id = 1
AND detail_log_status = 'U';
v_update_xsl := v_update_xsl || '
v_update_xsl := v_update_xsl || p_source || ''']">';
v_update_xsl := v_update_xsl || v_rows_count || '';
SELECT COUNT(1)
INTO v_rows_count
FROM az_diff_results d
WHERE request_id = p_request_id
AND source = p_source
AND parent_id = 1
AND(detail_log_status LIKE 'S%' OR detail_log_status = 'E');
v_update_xsl := v_update_xsl || '
v_update_xsl := v_update_xsl || p_source || ''']">';
v_update_xsl := v_update_xsl || v_rows_count || '';
SELECT COUNT(1)
INTO v_rows_count
FROM az_diff_results d
WHERE request_id = p_request_id
AND source = p_source
AND parent_id = 1
AND detail_log_status = 'IW';
v_update_xsl := v_update_xsl || '
v_update_xsl := v_update_xsl || p_source || ''']">';
v_update_xsl := v_update_xsl || v_rows_count || '';
SELECT COUNT(1)
INTO v_rows_count
FROM az_diff_results d
WHERE request_id = p_request_id
AND source = p_source
AND parent_id = 1
AND detail_log_status = 'UW';
v_update_xsl := v_update_xsl || '
v_update_xsl := v_update_xsl || p_source || ''']">';
v_update_xsl := v_update_xsl || v_rows_count || '';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
v_update_xsl := v_update_xsl || ' ';
p_update_xsl := v_update_xsl;
|| to_char(systimestamp) , 'Generated v_update_xsl: ' || v_update_xsl);
raise_error_msg(SQLCODE, sqlerrm, 'update_det_log_counts', 'Error while updating the count based on type of status');
END update_det_log_counts;