The following lines contain the word 'select', 'insert', 'update' or 'delete':
select count(thread_id)
from
( select fth.forum_thread_id thread_id
from ota_forum_threads fth
where fth.private_thread_flag = 'N'
and fth.forum_id = p_forum_id
UNION ALL
select fth.forum_thread_id
from ota_forum_threads fth,
ota_pvt_frm_thread_users users
where fth.forum_thread_id = users.forum_thread_id
and fth.private_thread_flag = 'Y'
and users.person_id = p_person_id
and fth.forum_id = p_forum_id);
select count(message_id)
from
(
select message.forum_message_id message_id
from ota_forum_messages message, ota_forum_threads threads
where message.forum_thread_id = threads.forum_thread_id
and threads.private_thread_flag = 'N'
and message.forum_id = p_forum_id
UNION ALL
select message.forum_message_id message_id
from ota_forum_messages message, ota_forum_threads threads,
ota_pvt_frm_thread_users pvtusers
where message.forum_thread_id = threads.forum_thread_id
and threads.forum_id = p_forum_id
and threads.private_thread_flag = 'Y'
and message.forum_thread_id = pvtusers.forum_thread_id
and pvtusers.person_id = p_person_id
and (message.message_scope = 'T'
or (message.message_scope = 'U'
and (message.person_id = p_person_id
or message.target_person_id = p_person_id
)
)
)
);
select max(message.creation_date)
from ota_forum_messages message, ota_forum_threads thread
where message.forum_thread_id = thread.forum_thread_id
and message.forum_id = p_forum_id;