The following lines contain the word 'select', 'insert', 'update' or 'delete':
select 1
from pa_lookups
where lookup_type ='PM_PRODUCT_CODE'
and lookup_code=P_pm_product_code;
IF (p_pm_product_code IS NOT NULL AND p_function_name <> 'PA_EV_UPDATE_EVENT') /* Added for bug 5056969 */
THEN
IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_ERROR)
THEN
pa_interface_utils_pub.map_new_amg_msg
( p_old_message_code => 'PA_PRODUCT_CODE_IS_MISS'
,p_msg_attribute => 'CHANGE'
,p_resize_flag => 'N'
,p_msg_context => 'GENERAL'
,p_attribute1 => ''
,p_attribute2 => ''
,p_attribute3 => ''
,p_attribute4 => ''
,p_attribute5 => '');
FUNCTION CHECK_UPDATE_EVENT_OK
(P_pm_product_code IN VARCHAR2
,P_event_in_rec IN pa_event_pub.Event_rec_in_type
,P_project_currency_code IN VARCHAR2
,P_proj_func_currency_code IN VARCHAR2
,P_project_bil_rate_date_code IN VARCHAR2
,P_project_rate_type IN VARCHAR2
,p_project_bil_rate_date IN VARCHAR2
,p_projfunc_bil_rate_date_code IN VARCHAR2
,P_projfunc_rate_type IN VARCHAR2
,p_projfunc_bil_rate_date IN VARCHAR2
,P_funding_rate_type IN VARCHAR2
,P_multi_currency_billing_flag IN VARCHAR2
,p_project_id IN NUMBER
,p_projfunc_bil_exchange_rate IN NUMBER -- Added bug 3013137
,p_funding_bill_rate_date_code IN VARCHAR2 --Added for bug 3053190
,x_task_id OUT NOCOPY NUMBER --File.Sql.39 bug 4440895
,x_organization_id OUT NOCOPY NUMBER --File.Sql.39 bug 4440895
,x_inv_org_id OUT NOCOPY NUMBER --File.Sql.39 bug 4440895
,x_agreement_id OUT NOCOPY NUMBER -- Federal Uptake
,p_event_type_classification OUT NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
,P_event_processed OUT NOCOPY VARCHAR2) /* Added for bug 7110782 */
RETURN VARCHAR2
AS
l_proj_func_currency_code PA_EVENTS.projfunc_currency_code%TYPE;
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Beginning of Check Update Event Ok'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating if the event is processed.'
,x_log_level => 5);
SELECT deliverable_id
INTO l_deliverable_id
FROM PA_EVENTS
WHERE EVENT_ID=P_event_in_rec.P_event_id
AND deliverable_id IS NULL;
can be updated .However the DFF will be updateable. */
if (
P_event_in_rec.P_Task_Number IS NOT NULL OR
P_event_in_rec.p_event_number IS NOT NULL OR
P_event_in_rec.P_event_type IS NOT NULL OR
P_event_in_rec.P_project_number IS NOT NULL OR
P_event_in_rec.P_agreement_number IS NOT NULL OR
P_event_in_rec.P_inventory_org_name IS NOT NULL OR
P_event_in_rec.P_inventory_item_id IS NOT NULL OR
P_event_in_rec.P_quantity_billed IS NOT NULL OR
P_event_in_rec.P_uom_code IS NOT NULL OR
P_event_in_rec.P_unit_price IS NOT NULL OR
P_event_in_rec.P_reference1 IS NOT NULL OR
P_event_in_rec.P_reference2 IS NOT NULL OR
P_event_in_rec.P_reference3 IS NOT NULL OR
P_event_in_rec.P_reference4 IS NOT NULL OR
P_event_in_rec.P_reference5 IS NOT NULL OR
P_event_in_rec.P_reference6 IS NOT NULL OR
P_event_in_rec.P_reference7 IS NOT NULL OR
P_event_in_rec.P_reference8 IS NOT NULL OR
P_event_in_rec.P_reference9 IS NOT NULL OR
P_event_in_rec.P_reference10 IS NOT NULL OR
P_event_in_rec.P_bill_trans_currency_code IS NOT NULL OR
/* P_event_in_rec.P_bill_trans_bill_amount IS NOT NULL OR commented for bug 8485535*/
(P_event_in_rec.P_bill_trans_rev_amount IS NOT NULL and l_event_processed='C') OR /* Modified for bug 8485535*/
P_event_in_rec.P_project_rate_type IS NOT NULL OR
P_event_in_rec.P_project_rate_date IS NOT NULL OR
P_event_in_rec.P_project_exchange_rate IS NOT NULL OR
P_event_in_rec.P_projfunc_rate_type IS NOT NULL OR
P_event_in_rec.P_projfunc_rate_date IS NOT NULL OR
P_event_in_rec.P_projfunc_exchange_rate IS NOT NULL OR
P_event_in_rec.P_funding_rate_type IS NOT NULL OR
P_event_in_rec.P_funding_rate_date IS NOT NULL OR
P_event_in_rec.P_funding_exchange_rate IS NOT NULL OR
P_event_in_rec.P_adjusting_revenue_flag IS NOT NULL ) THEN
IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_ERROR)
THEN
pa_interface_utils_pub.map_new_amg_msg
( p_old_message_code => 'PA_EVENT_CANCEL_UPD'
,p_msg_attribute => 'CHANGE'
,p_resize_flag => 'N'
,p_msg_context => 'EVENT'
,p_attribute1 => P_event_in_rec.p_pm_event_reference
,p_attribute2 => ''
,p_attribute3 => ''
,p_attribute4 => ''
,p_attribute5 => '');
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating task for the given project'
,x_log_level => 5);
select task_id
into x_task_id
from pa_events
where event_id = P_event_in_rec.P_event_id;
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating funding level of the project'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating agreement for the given project'
,x_log_level => 5);
select agreement_id
into x_agreement_id
from pa_events
where event_id = P_event_in_rec.P_event_id;
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_CREATE_UPDATE_OK.begin'
,x_msg => 'Validating event date is between agreement date'
,x_log_level => 5);
select completion_date
into l_event_date
from pa_events
where event_id = P_event_in_rec.P_event_id;
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating the event_type'
,x_log_level => 5);
SELECT t.event_type_classification
INTO p_event_type_classification
FROM pa_event_types t,pa_events v
WHERE v.event_id=P_event_in_rec.P_event_id
AND t.event_type=v.event_type ;
SELECT bill_trans_rev_amount,
bill_trans_bill_amount
INTO l_old_rev_amount,
l_old_bill_amount
FROM pa_events
WHERE event_id = p_event_in_rec.P_event_id;
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating organisation name and deriving organisation_id'
,x_log_level => 5);
/* For bug 3053190.Moved the following select from below and added the columns
PROJECT_RATE_DATE,PROJFUNC_RATE_DATE,FUNDING_RATE_DATE to the select */
/*Added for bug 3053669 The validation should happen if the revenue amount passed is not null
OR the revenue amount present in the database is not NULL .Selecting the completion date of the
event for validation of Write Off events */
SELECT decode(p_event_in_rec.P_bill_trans_rev_amount,NULL,bill_trans_rev_amount,
p_event_in_rec.P_bill_trans_rev_amount),
decode(p_event_in_rec.P_bill_trans_bill_amount,NULL,bill_trans_bill_amount,
p_event_in_rec.P_bill_trans_bill_amount),
decode(p_event_in_rec.p_completion_date,NULL,ev.completion_date,P_event_in_rec.p_completion_date),
decode(p_event_in_rec.P_adjusting_revenue_flag,NULL,ev.adjusting_revenue_flag,
p_event_in_rec.P_adjusting_revenue_flag),
decode(p_event_in_rec.P_projfunc_rate_date,NULL,ev.projfunc_rate_date,
PA_INTERFACE_UTILS_PUB.G_PA_MISS_DATE,ev.projfunc_rate_date,
p_event_in_rec.P_projfunc_rate_date),
decode(p_event_in_rec.P_project_rate_date,NULL,ev.project_rate_date,
PA_INTERFACE_UTILS_PUB.G_PA_MISS_DATE,ev.project_rate_date,
p_event_in_rec.P_project_rate_date),
decode(p_event_in_rec.P_funding_rate_date,NULL,ev.funding_rate_date,
PA_INTERFACE_UTILS_PUB.G_PA_MISS_DATE,ev.funding_rate_date,
p_event_in_rec.P_funding_rate_date)
into l_revenue_amount,l_bill_amount,l_completion_date,l_adjusting_revenue_flag,
l_check_projfunc_rate_date,l_check_project_rate_date,l_check_funding_rate_date
from pa_events ev
where ev.event_id = p_event_in_rec.P_event_id;
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Start of MCB Validations '
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating bill trans currency code'
,x_log_level => 5);
SELECT bill_trans_currency_code
INTO l_proj_func_currency_code
FROM pa_events
WHERE event_id = P_event_in_rec.P_event_id;
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating funding rate type'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating project rate type.'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating project functional rate type.'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating the Adjusting Revenue flag.'
,x_log_level => 5);
OR the revenue amount present in the database is not NULL .Selecting the completion date of the
event for validation of Write Off events */
/* SELECT decode(p_event_in_rec.P_bill_trans_rev_amount,NULL,bill_trans_rev_amount,
p_event_in_rec.P_bill_trans_rev_amount),
decode(p_event_in_rec.P_bill_trans_bill_amount,NULL,bill_trans_bill_amount,
p_event_in_rec.P_bill_trans_bill_amount),
decode(p_event_in_rec.p_completion_date,NULL,ev.completion_date,P_event_in_rec.p_completion_date),
decode(p_event_in_rec.P_adjusting_revenue_flag,NULL,ev.adjusting_revenue_flag,
p_event_in_rec.P_adjusting_revenue_flag)
into l_revenue_amount,l_bill_amount,l_completion_date,l_adjusting_revenue_flag
from pa_events ev
where ev.event_id = p_event_in_rec.P_event_id; */
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating the revenue amount.'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating the bill amount.'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating the Bill hold flag.'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating event number.'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating inventory organization name and deriving inventory organization id.'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'Validating inventory item id.'
,x_log_level => 5);
pa_debug.write_log (x_module => 'pa.plsql.PA_EVENT_PVT.CHECK_UPDATE_EVENT_OK.begin'
,x_msg => 'End of Check Update Event Ok'
,x_log_level => 5);
PA_EVENT_PUB.PROCEDURE_NAME:=PA_EVENT_PUB.PROCEDURE_NAME||'CHECK_UPDATE_EVENT_OK->';
PA_EVENT_PUB.PROCEDURE_NAME:=PA_EVENT_PUB.PROCEDURE_NAME||substr(sqlerrm,1,80)||'CHECK_UPDATE_EVENT_OK->';
END CHECK_UPDATE_EVENT_OK;
Select 'x'
From pa_events
Where event_id=P_event_id;
SELECT pm_event_reference
INTO P_pm_event_reference
FROM PA_EVENTS
WHERE event_id=p_event_id;
FUNCTION CHECK_DELETE_EVENT_OK
(P_pm_event_reference IN VARCHAR2
,P_event_id IN NUMBER)
RETURN VARCHAR2
AS
P_event_id_out NUMBER:=NULL;
SELECT deliverable_id
INTO l_deliverable_id
FROM PA_EVENTS
WHERE EVENT_ID=P_event_id
AND deliverable_id IS NULL;
SELECT t.event_type_classification
INTO p_event_type_classification
FROM pa_event_types t,pa_events v
WHERE v.event_id=P_event_id
AND t.event_type=v.event_type ;
SELECT bill_trans_rev_amount,
bill_trans_bill_amount
INTO l_rev_amount,
l_bill_amount
FROM pa_events
WHERE event_id = P_event_id;
PA_EVENT_PUB.PROCEDURE_NAME:=PA_EVENT_PUB.PROCEDURE_NAME||'CHECK_DELETE_EVENT_OK->';
PA_EVENT_PUB.PROCEDURE_NAME:=PA_EVENT_PUB.PROCEDURE_NAME||substr(sqlerrm,1,80)||'CHECK_DELETE_EVENT_OK->';
END CHECK_DELETE_EVENT_OK;
select 1
from pa_lookups
where lookup_type ='PM_PRODUCT_CODE'
and lookup_code=P_pm_product_code;
Select 1
From pa_events
Where pm_product_code=P_pm_product_code
And pm_event_reference =P_pm_event_reference;
Select event_id
From pa_events
Where pm_event_reference = p_pm_event_reference
And pm_product_code = p_pm_product_code;