The following lines contain the word 'select', 'insert', 'update' or 'delete':
G_RECORD_DELETED CONSTANT VARCHAR2(200) := OKC_API.G_RECORD_DELETED;
G_RECORD_LOGICALLY_DELETED CONSTANT VARCHAR2(200) := OKC_API.G_RECORD_LOGICALLY_DELETED;
SELECT terms_display_order
FROM okc_terms_artsec_disp_temp
WHERE terms_id = p_terms_id
AND terms_type = p_terms_type
AND processed_flag = 'Y';
SELECT document_id,
document_type,
terms_type,
terms_id,
parent_id,
terms_display_sequence,
terms_display_level,
LPAD(ROWNUM,5,'0') disp_order,
'Y',
runid
FROM okc_terms_artsec_disp_temp
WHERE document_id = p_document_id
AND document_type = p_document_type
AND processed_flag = 'N'
AND parent_id IS null
AND terms_type = 'SECTION'
ORDER BY terms_display_sequence ;
SELECT document_id,
document_type,
terms_type,
terms_id,
parent_id,
terms_display_level,
terms_display_sequence,
runid
FROM okc_terms_artsec_disp_temp t
WHERE document_id = lc_document_id
AND document_type = lc_document_type
AND processed_flag = 'N'
AND exists (SELECT 1
FROM okc_terms_artsec_disp_temp t1
WHERE t1.terms_type = 'SECTION'
AND t1.terms_id = t.parent_id
AND t1.document_id = lc_document_id
AND t1.document_type = lc_document_type
AND t1.terms_display_level = lc_level)
ORDER BY parent_id,terms_display_sequence;
SELECT NVL(MAX(terms_display_level),0)
FROM okc_terms_artsec_disp_temp
WHERE document_id = lc_document_id
AND document_type = lc_document_type
AND processed_flag = 'N';
DELETE FROM okc_terms_artsec_disp_temp
WHERE document_id = p_document_id
AND document_type = p_document_type;
INSERT INTO okc_terms_artsec_disp_temp
(document_id,
document_type,
terms_type,
terms_id,
parent_id,
terms_display_sequence,
terms_display_level,
terms_display_order,
processed_flag,
runid
)
(select document_id,
document_type,
'SECTION',
id,
scn_id,
section_sequence,
level,
'',
'N',
p_run_id
from okc_sections_b
where document_id = p_document_id
and document_type = p_document_type
connect by prior id = scn_id
start with scn_id is null);
INSERT INTO okc_terms_artsec_disp_temp
(document_id,
document_type,
terms_type,
terms_id,
parent_id,
terms_display_sequence,
terms_display_level,
terms_display_order,
processed_flag,
runid
)
(select document_id,
document_type,
'ARTICLE',
id,
scn_id,
display_sequence,
null,
'',
'N',
p_run_id
from okc_k_articles_b
where document_id = p_document_id
and document_type = p_document_type);
insert into okc_terms_artsec_disp_temp
(document_id,
document_type,
terms_type,
terms_id,
parent_id,
terms_display_sequence,
terms_display_level,
terms_display_order,
processed_flag
)
SELECT document_id,
document_type,
terms_type,
terms_id,
parent_id,
terms_display_sequence,
terms_display_level,
LPAD(ROWNUM,5,'0'),
'Y'
FROM okc_terms_artsec_disp_temp
WHERE document_id = p_document_id
AND document_type = p_document_type
AND processed_flag = 'N'
AND parent_id IS null
AND terms_type = 'SECTION'
ORDER BY terms_display_sequence ;
insert into okc_terms_artsec_disp_temp
(document_id,
document_type,
terms_type,
terms_id,
parent_id,
terms_display_sequence,
terms_display_level,
terms_display_order,
processed_flag,
runid
)
VALUES
( rec.document_id,
rec.document_type,
rec.terms_type,
rec.terms_id,
rec.parent_id,
rec.terms_display_sequence,
rec.terms_display_level,
LPAD(l_display_order,5,'0'),
'Y',
rec.runid);
insert into okc_terms_artsec_disp_temp
( document_id,
document_type,
terms_type,
terms_id,
parent_id,
terms_display_sequence,
terms_display_level,
terms_display_order,
processed_flag,
runid
)
VALUES
( rec.document_id,
rec.document_type,
rec.terms_type,
rec.terms_id,
rec.parent_id,
rec.terms_display_sequence,
rec.terms_display_level,
l_parent_disp_order||'.'||LPAD(l_display_order,5,'0'),
'Y',
rec.runid
);
DELETE FROM okc_terms_artsec_disp_temp
WHERE document_id = p_document_id
AND document_type = p_document_type
AND processed_flag = 'N';
SELECT '1'
FROM OKC_TERMS_ARTSEC_DISP_TEMP
WHERE document_type = p_document_type
AND document_id = p_document_id
AND runid = p_run_id;
SELECT '1'
FROM OKC_TERMS_ARTSEC_DISP_TEMP
WHERE document_type = p_document_type
AND document_id = p_document_id;