The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT 'X'
FROM igs_ps_pat_study_unt psu,
igs_ps_unit_ver_all a,
igs_ps_unit_stat b
WHERE
psu.course_cd = p_course_cd AND
psu.version_number = p_version_number AND
psu.cal_type = p_cal_type AND
psu.pos_sequence_number = p_pos_sequence_number AND
psu.unit_cd = p_unit_cd AND
psu.unit_cd = a.unit_cd AND
a.same_teaching_period = 'Y' AND
((a.expiry_dt IS NULL) OR (TRUNC(a.expiry_dt) >= TRUNC(SYSDATE))) AND
a.unit_status = b.unit_status AND
b.s_unit_status <> 'INACTIVE' AND
(p_sequence_number IS NULL OR psu.sequence_number <> p_sequence_number); --leave this record
SELECT COUNT(*)
FROM igs_ps_pat_study_unt psu
WHERE
psu.course_cd = p_course_cd AND
psu.version_number = p_version_number AND
psu.cal_type = p_cal_type AND
psu.pos_sequence_number = p_pos_sequence_number AND
psu.unit_cd = p_unit_cd AND
(p_sequence_number IS NULL OR psu.sequence_number <> p_sequence_number); --leave this record
SELECT 'X'
FROM IGS_PS_PAT_STUDY_UNT
WHERE
course_cd = p_course_cd AND
version_number = p_version_number AND
cal_type = p_cal_type AND
pos_sequence_number = p_pos_sequence_number AND
posp_sequence_number = p_posp_sequence_number AND
NVL(unit_cd,'NULL') = NVL(p_unit_cd,'NULL') AND
NVL(unit_location_cd,'NULL') = NVL(p_location_cd,'NULL') AND
NVL(unit_class,'NULL') = NVL(p_unit_class,'NULL') AND
(p_sequence_number IS NULL OR
sequence_number <> p_sequence_number);
SELECT posp_sequence_number
FROM IGS_PS_PAT_STUDY_UNT
WHERE
course_cd = p_course_cd AND
version_number = p_version_number AND
cal_type = p_cal_type AND
pos_sequence_number = p_pos_sequence_number AND
NVL(unit_cd,'NULL') = NVL(p_unit_cd,'NULL') AND
NVL(unit_location_cd,'NULL') = NVL(p_location_cd,'NULL') AND
NVL(unit_class,'NULL') = NVL(p_unit_class,'NULL') AND
(p_sequence_number IS NULL OR
sequence_number <> p_sequence_number);
SELECT 'X'
FROM IGS_PS_PAT_STUDY_PRD posp,
IGS_PS_UNIT_OFR_OPT uoo,
IGS_CA_INST ci
WHERE posp.course_cd = p_course_cd AND
posp.version_number = p_version_number AND
posp.cal_type = p_cal_type AND
posp.pos_sequence_number = p_pos_sequence_number AND
posp.sequence_number = p_posp_sequence_number AND
uoo.unit_cd = p_unit_cd AND
uoo.cal_type = posp.teach_cal_type AND
(p_unit_location_cd IS NULL OR
uoo.location_cd = p_unit_location_cd) AND
(p_unit_class IS NULL OR
uoo.unit_class = p_unit_class) AND
uoo.cal_type = ci.cal_type AND
uoo.ci_sequence_number = ci.sequence_number AND
ci.end_dt > SYSDATE;
SELECT 'X'
FROM IGS_PS_UNIT_VER uv,
IGS_PS_UNIT_STAT ust
WHERE uv.unit_cd = p_unit_cd AND
uv.unit_status = ust.unit_status AND
ust.s_unit_status = 'ACTIVE';