The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT po_header_id
INTO p_po_header_id
FROM po_headers_all
WHERE segment1 = p_po_number
AND org_id = p_org_id;
SELECT po_line_id
INTO p_po_line_id
FROM po_lines_all
WHERE line_num = p_po_line_num
AND po_header_id = p_po_header_id
AND org_id = p_org_id;
SELECT line_location_id
INTO l_line_location_id
FROM po_line_locations_all
WHERE po_line_id = p_po_line_id;
SELECT min(po_distribution_id)
INTO l_distribution_id
FROM po_distributions_all
WHERE po_line_id = p_po_line_id
AND project_id = p_project_id
AND task_id = p_task_id;
-- This is used in the case when user select a Project on the Timecard which doesn't
-- matches with the projects in Purchase Order which was selected on Time card.
IF l_distribution_id IS NULL THEN
SELECT MIN(psp.po_distribution_id)
INTO l_distribution_id
FROM PO_SP_VAL_V psp
WHERE psp.po_line_id = p_po_line_id
AND psp.project_id IS NOT NULL
AND psp.task_id IS NOT NULL
AND psp.VALIDATE_PROJECT_FLAG = 'Y';
-- This Change is made because the Project selected by User on the Timecard might
-- match with the projects in Purchase Order and might doesn't matches.
SELECT sum(nvl(pod1.amount_ordered,0) - nvl(pod1.amount_cancelled,0))
INTO x_po_line_amt
FROM po_distributions_all pod1,
po_distributions_all pod2
WHERE pod1.po_line_id = pod2.po_line_id
AND pod1.project_id = pod2.project_id
AND pod1.task_id = pod2.task_id
AND pod2.po_distribution_id = l_distribution_id;
SELECT po_line_id
INTO l_po_line_id
FROM po_distributions_all
WHERE po_distribution_id = p_po_distribution_id;
SELECT poh.po_header_id,
poh.vendor_id
INTO l_po_header_id,
x_vendor_id
FROM po_lines_all pol,
po_headers_all poh
WHERE pol.po_header_id = poh.po_header_id
AND pol.po_line_id = p_po_line_id;
SELECT min(po_distribution_id)
INTO l_distribution_id
FROM po_distributions_all
WHERE po_line_id = p_po_line_id
AND project_id = p_project_id
AND task_id = p_task_id;
-- This is used in the case when user select a Project on the Timecard which doesn't
-- matches with the projects in Purchase Order which was selected on Time card.
IF l_distribution_id IS NULL THEN
SELECT MIN(psp.po_distribution_id)
INTO l_distribution_id
FROM PO_SP_VAL_V psp
WHERE psp.po_line_id = p_po_line_id
AND psp.project_id IS NOT NULL
AND psp.task_id IS NOT NULL
AND psp.VALIDATE_PROJECT_FLAG = 'Y';
SELECT rate_date,
rate
INTO l_rate_date,
l_rate
FROM po_distributions_all
WHERE po_distribution_id = l_distribution_id;
select 'Y'
INTO X_flag
from dual
where exists(
SELECT po_header_id,po_line_id
FROM po_sp_val_v
where person_id = p_person_id
AND fnd_date.canonical_to_date(fnd_date.date_to_canonical(l_effective_date)) >=
fnd_date.canonical_to_date(fnd_date.date_to_canonical(pol_start_date))
AND fnd_date.canonical_to_date(fnd_date.date_to_canonical(l_effective_date)) <=
fnd_date.canonical_to_date(fnd_date.date_to_canonical(pol_expiration_date))
AND fnd_date.canonical_to_date(fnd_date.date_to_canonical(l_effective_date)) >=
fnd_date.canonical_to_date(fnd_date.date_to_canonical(assignmt_effective_start_date))
AND fnd_date.canonical_to_date(fnd_date.date_to_canonical(l_effective_date)) <=
fnd_date.canonical_to_date(fnd_date.date_to_canonical(assignmt_effective_end_date))
AND po_header_id = p_po_header_id
AND po_line_id = p_po_line_id
);