The following lines contain the word 'select', 'insert', 'update' or 'delete':
if pa_security.allow_update(X_project_id) = 'N' then
FND_MESSAGE.SET_NAME('PA','PA_PROJECT_SECURITY_ENFORCED');
select null
into dummy
from sys.dual
where exists (
select null
from pa_draft_revenues
where project_id = X_project_id
and draft_revenue_num = X_draft_revenue_num
and released_date is null
and NVL(generation_error_flag, 'N') = 'N');
Select nvl(adjusting_revenue_flag,'N') into adj_flag
from pa_draft_revenues_all where project_id = X_project_id and
draft_revenue_num = X_draft_revenue_num;
select null
into dummy
from sys.dual
where not exists (
select null
from pa_draft_revenues
where project_id = X_project_id
and draft_revenue_num < X_draft_revenue_num
and released_date is null
and nvl(adjusting_revenue_flag,'N') = adj_flag );
if pa_security.allow_update(X_project_id) = 'N' then
FND_MESSAGE.SET_NAME('PA','PA_PROJECT_SECURITY_ENFORCED');
select null
into dummy
from sys.dual
where exists (
select null
from pa_draft_revenues
where project_id = X_project_id
and draft_revenue_num = X_draft_revenue_num
and released_date is not null
and transfer_status_code in ('P', 'R'));
Select nvl(adjusting_revenue_flag,'N') into adj_flag
from pa_draft_revenues_all where project_id = X_project_id and
draft_revenue_num = X_draft_revenue_num;
select null
into dummy
from sys.dual
where not exists (
select null
from pa_draft_revenues
where project_id = X_project_id
and draft_revenue_num > X_draft_revenue_num
and released_date is not null
and nvl(adjusting_revenue_flag,'N') = adj_flag );
select null
into dummy
from sys.dual
where not exists (
select null
from pa_draft_invoices
where (project_id, draft_invoice_num) in
(select project_id,draft_invoice_num
from pa_cust_rev_dist_lines
where project_id = X_project_id
and draft_revenue_num = X_draft_revenue_num
union
select project_id,draft_invoice_num
from pa_cust_event_rev_dist_lines
where project_id = X_project_id
and draft_revenue_num = X_draft_revenue_num
union /* Start of Changes for bug 5401384 -base bug 5246804 */
select distinct dii.project_id,dii.draft_invoice_num
from pa_draft_invoice_items dii, pa_events e
where dii.project_id=X_project_id
and dii.event_num is not null
AND e.event_num = dii.event_num
and nvl(e.task_id,-99) = nvl(dii.event_task_id,-99)
AND EXISTS (SELECT 1 FROM pa_event_types et
WHERE e.event_type = et.event_type
and et.event_type_classification = 'AUTOMATIC')
and exists
(select 1
from pa_cust_event_RDL_ALL
where project_id = dii.project_id
and draft_revenue_num = X_draft_revenue_num
and event_num = dii.event_num
and NVL(task_id,-99) = NVL(dii.event_task_id,-99)
))/* End of Changes for bug 5401384 - base bug 5246804 */
and released_date is not null);
select null
into dummy
from sys.dual
where not exists (
select null
from pa_draft_revenues
where project_id = X_project_id
and draft_revenue_num = X_draft_revenue_num
and (nvl(resource_accumulated_flag, 'N') = 'Y'
or nvl(accumulated_flag, 'N') = 'Y'));
update pa_draft_revenues
set released_date = sysdate,
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.login_id
where project_id = X_project_id
and draft_revenue_num = X_draft_revenue_num;
update pa_draft_revenues
set released_date = NULL,
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.login_id
where project_id = X_project_id
and draft_revenue_num = X_draft_revenue_num;