The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT ga.award_id
FROM gms_awards_all ga
WHERE ((p_award_number IS NULL AND ga.award_id = NVL(p_award_id,0)) OR
(ga.award_number = p_award_number) );
-- This will insert a reversed expendtiure_item record and two new expenditure_items records into ADL table.
-- =========================================================================================================
PROCEDURE GMS_SPLIT (x_expenditure_item_id IN NUMBER ) IS
adl_rec gms_award_distributions%ROWTYPE;
SELECT * from pa_expenditure_items_all
WHERE adjusted_expenditure_item_id = x_expenditure_item_id ;
SELECT * from pa_expenditure_items_all
WHERE transferred_from_exp_item_id = x_expenditure_item_id ;
select DISTINCT award_id -- Fix for bug : 1786003
-- , bill_hold_flag -- Don't need to get bill_hold_flag
into source_award_id
-- ,x_flag
from gms_award_distributions adl
where adl.expenditure_item_id = x_expenditure_item_id
and adl.document_type = 'EXP'
and adl_status = 'A' ;
adl_rec.last_update_date := rev_rec.last_update_date;
adl_rec.last_updated_by := rev_rec.last_updated_by;
adl_rec.last_update_login := rev_rec.last_update_login;
adl_rec.last_update_date := new_rec.last_update_date;
adl_rec.last_updated_by := new_rec.last_updated_by;
adl_rec.last_update_login := new_rec.last_update_login;
update pa_expenditure_items_all
set billable_flag = x_billable_flag
where expenditure_item_id = new_rec.expenditure_item_id
and exists (select 1 from pa_project_types t, pa_projects pa
where pa.project_id = SOURCE_PROJECT_ID
and pa.project_type=t.project_type
and t.Project_type_class_code= 'INDIRECT');
select expenditure_type
from gms_allowable_expenditures
where allowability_schedule_id = x_allowable_id
and expenditure_type = x_expenditure_type;
select status,allowable_schedule_id ,nvl(preaward_date, start_date_active) start_date_active ,
end_date_active,close_date
from gms_awards_all
where award_id = source_award_id ;
select status,allowable_schedule_id ,nvl(preaward_date, start_date_active) start_date_active ,
end_date_active,close_date
from gms_awards_all
where award_id = dest_award_id ;
select expenditure_type,expenditure_item_date
from pa_expenditure_items_all
where expenditure_item_id = x_expenditure_item_id;
CURSOR c1 is select ex.expenditure_item_id
from gms_award_distributions adl, pa_expenditure_items_all ex
where ex.expenditure_item_id = x_expenditure_item_id
and ex.expenditure_item_id = adl.expenditure_item_id
and ex.task_id = adl.task_id
and adl.award_id = source_award_id
and adl.document_type = 'EXP'
and adl.adl_status = 'A'
and adl.adl_line_num = 1 ;
select 'X'
FROM pa_projects_all P,
gms_project_types gpt
WHERE p.project_id = X_project_id
AND p.project_type = gpt.project_type
and gpt.sponsored_flag = 'Y' ;
SELECT * from pa_expenditure_items_all
WHERE adjusted_expenditure_item_id = x_exp_item_id ;
SELECT * from pa_expenditure_items_all
WHERE transferred_from_exp_item_id = x_exp_item_id ;
adl_rec.last_update_date := rev_rec.last_update_date;
adl_rec.last_updated_by := rev_rec.last_updated_by;
adl_rec.last_update_login := rev_rec.last_update_login;
adl_rec.last_update_date := new_rec.last_update_date;
adl_rec.last_updated_by := new_rec.last_updated_by;
adl_rec.last_update_login := new_rec.last_update_login;
SELECT gt.award_id award_id,
gt.award_number award_number, -- Bug 3221039
NULL invoice_distribution_id,
ei.cost_distributed_flag cost_distributed_flag,
ei.revenue_distributed_flag revenue_distributed_flag,
pt.txn_interface_id TXN_INTERFACE_ID,
pt.accrual_flag period_end_accrual_flag,
pt.system_linkage system_linkage
FROM gms_transaction_interface_all gt,
pa_transaction_interface_all pt,
pa_expenditure_items_all ei
WHERE ei.expenditure_item_id = x_ei_id
AND ei.expenditure_id = x_exp_id
AND ei.transaction_source = x_trx_src
and ei.transaction_source = pt.transaction_source
and ei.orig_transaction_reference = pt.orig_transaction_reference
and ei.expenditure_id = pt.expenditure_id
and ei.expenditure_item_id = pt.expenditure_item_id
and pt.txn_interface_id = gt.txn_interface_id;
SELECT * from gms_award_distributions
where award_set_id = x_award_set_id
and adl_status = 'A' ;
SELECT cdl.line_num
FROM pa_cost_distribution_lines cdl
WHERE cdl.expenditure_item_id = X_ei_id
and line_num_reversed is null
and reversed_flag is NULL ;
SELECT nvl(purgeable_flag, 'N'), nvl(gl_accounted_flag, 'N')
FROM pa_transaction_sources
WHERE transaction_source = x_trx_src ;
select ei.expenditure_item_id
into x_adl_rec.expenditure_item_id
from pa_expenditure_items_all ei
where ei.adjusted_expenditure_item_id = x_ei_id ;
DELETE from gms_transaction_interface_all
WHERE txn_interface_id = x_txn_xface_id ;
SELECT set_of_books_id
INTO x_sob_id
FROM PA_IMPLEMENTATIONS ;
select ei.cost_distributed_flag, NVL( ei.override_to_organization_id, exp.incurred_by_organization_id )
into X_costed_flag, x_exp_org_id
from pa_expenditure_items_all ei,
pa_expenditures_all exp
where ei.expenditure_item_id = X_ei_id
and ei.expenditure_id = exp.expenditure_id ;
SELECT project_id
into X_project_id
from pa_tasks
where task_id = X_task_id
and rownum < 2 ;
Insert into gms_bc_packets
( PACKET_ID,
PROJECT_ID,
AWARD_ID,
TASK_ID,
EXPENDITURE_TYPE,
EXPENDITURE_ITEM_DATE,
ACTUAL_FLAG,
STATUS_CODE,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATED_BY,
CREATION_DATE,
LAST_UPDATE_LOGIN,
SET_OF_BOOKS_ID,
JE_CATEGORY_NAME,
JE_SOURCE_NAME,
TRANSFERED_FLAG,
DOCUMENT_TYPE,
EXPENDITURE_ORGANIZATION_ID,
PERIOD_NAME,
PERIOD_YEAR,
PERIOD_NUM,
DOCUMENT_HEADER_ID ,
DOCUMENT_DISTRIBUTION_ID,
TOP_TASK_ID,
BUDGET_VERSION_ID,
BUD_TASK_ID, -- Bug 3338999
RESOURCE_LIST_MEMBER_ID,
ACCOUNT_TYPE,
ENTERED_DR,
ENTERED_CR ,
TOLERANCE_AMOUNT,
TOLERANCE_PERCENTAGE,
OVERRIDE_AMOUNT,
EFFECT_ON_FUNDS_CODE ,
RESULT_CODE,
GL_BC_PACKETS_ROWID,
BC_PACKET_ID,
PARENT_BC_PACKET_ID,
VENDOR_ID)
select
gbc.PACKET_ID,
gbc.PROJECT_ID,
gbc.AWARD_ID,
gbc.TASK_ID,
icc.EXPENDITURE_TYPE,
trunc(gbc.EXPENDITURE_ITEM_DATE),
gbc.ACTUAL_FLAG,
gbc.STATUS_CODE,
gbc.LAST_UPDATE_DATE,
gbc.LAST_UPDATED_BY,
gbc.CREATED_BY,
gbc.CREATION_DATE,
gbc.LAST_UPDATE_LOGIN,
gbc.SET_OF_BOOKS_ID,
gbc.JE_CATEGORY_NAME,
gbc.JE_SOURCE_NAME,
gbc.TRANSFERED_FLAG,
gbc.DOCUMENT_TYPE,
gbc.EXPENDITURE_ORGANIZATION_ID,
gbc.PERIOD_NAME,
gbc.PERIOD_YEAR,
gbc.PERIOD_NUM,
gbc.DOCUMENT_HEADER_ID ,
gbc.DOCUMENT_DISTRIBUTION_ID,
gbc.TOP_TASK_ID,
gbc.BUDGET_VERSION_ID,
gbc.BUD_TASK_ID, -- Bug 3338999
NULL, -- gbc.RESOURCE_LIST_MEMBER_ID
gbc.ACCOUNT_TYPE,
-- Bug 1980810 PA Rounding function added
pa_currency.round_currency_amt(sign(nvl(entered_dr,0)) * abs(nvl(gbc.BURDENABLE_RAW_COST ,0) * nvl(cm.compiled_multiplier,0))),
pa_currency.round_currency_amt(sign(nvl(entered_cr,0)) * abs(nvl(gbc.BURDENABLE_RAW_COST ,0) * nvl(cm.compiled_multiplier,0))),
gbc.TOLERANCE_AMOUNT,
gbc.TOLERANCE_PERCENTAGE,
gbc.OVERRIDE_AMOUNT,
gbc.EFFECT_ON_FUNDS_CODE ,
gbc.RESULT_CODE,
gbc.gl_bc_packets_rowid,
gms_bc_packets_s.nextval,
gbc.BC_PACKET_ID,
gbc.vendor_id
from pa_ind_rate_sch_revisions irsr,
pa_cost_bases cb,
pa_expenditure_types et,
pa_ind_cost_codes icc,
pa_cost_base_exp_types cbet,
pa_ind_rate_schedules_all_bg irs,
pa_ind_compiled_sets ics,
pa_compiled_multipliers cm,
gms_bc_packets gbc
where irsr.cost_plus_structure = cbet.cost_plus_structure
and cb.cost_base = cbet.cost_base
and cb.cost_base_type = cbet.cost_base_type
and ics.cost_base = cbet.cost_base --Bug 3003584
and et.expenditure_type = icc.expenditure_type
and icc.ind_cost_code = cm.ind_cost_code
and cbet.cost_base = cm.cost_base
and cbet.cost_base_type = 'INDIRECT COST'
and cbet.expenditure_type = gbc.expenditure_type
and irs.ind_rate_sch_id = irsr.ind_rate_sch_id
and ics.ind_rate_sch_revision_id = irsr.ind_rate_sch_revision_id
and ics.organization_id = gbc.expenditure_organization_id
and ics.ind_compiled_set_id = gms_cost_plus_extn.AWARD_CMT_COMPILED_SET_ID( gbc.DOCUMENT_HEADER_ID ,
gbc.DOCUMENT_DISTRIBUTION_ID,
gbc.task_id,
gbc.document_type,
gbc.expenditure_item_date,
gbc.expenditure_type, -- Bug 3003584
gbc.expenditure_organization_id,
'C',
gbc.award_id )
--join with compiled setid of adl.
and cm.ind_compiled_set_id = ics.ind_compiled_set_id
and cm.compiled_multiplier <> 0
and gbc.packet_id = x_packet_id
and gbc.document_type = 'AP' ;
-- BUG: 1418038 Supplier invoice not updated properly in ASI and FC results .
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Insert into gms_bc_packets
( PACKET_ID,
PROJECT_ID,
AWARD_ID,
TASK_ID,
EXPENDITURE_TYPE,
EXPENDITURE_ITEM_DATE,
ACTUAL_FLAG,
STATUS_CODE,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATED_BY,
CREATION_DATE,
LAST_UPDATE_LOGIN,
SET_OF_BOOKS_ID,
JE_CATEGORY_NAME,
JE_SOURCE_NAME,
TRANSFERED_FLAG,
DOCUMENT_TYPE,
EXPENDITURE_ORGANIZATION_ID,
PERIOD_NAME,
PERIOD_YEAR,
PERIOD_NUM,
DOCUMENT_HEADER_ID ,
DOCUMENT_DISTRIBUTION_ID,
TOP_TASK_ID,
BUDGET_VERSION_ID,
BUD_TASK_ID,
RESOURCE_LIST_MEMBER_ID,
ACCOUNT_TYPE,
ENTERED_DR,
ENTERED_CR ,
TOLERANCE_AMOUNT,
TOLERANCE_PERCENTAGE,
OVERRIDE_AMOUNT,
EFFECT_ON_FUNDS_CODE ,
RESULT_CODE,
GL_BC_PACKETS_ROWID,
BC_PACKET_ID,
PARENT_BC_PACKET_ID,
VENDOR_ID)
select
gbc.PACKET_ID,
gbc.PROJECT_ID,
gbc.AWARD_ID,
gbc.TASK_ID,
icc.EXPENDITURE_TYPE,
trunc(gbc.EXPENDITURE_ITEM_DATE),
gbc.ACTUAL_FLAG,
gbc.STATUS_CODE,
gbc.LAST_UPDATE_DATE,
gbc.LAST_UPDATED_BY,
gbc.CREATED_BY,
gbc.CREATION_DATE,
gbc.LAST_UPDATE_LOGIN,
gbc.SET_OF_BOOKS_ID,
gbc.JE_CATEGORY_NAME,
gbc.JE_SOURCE_NAME,
gbc.TRANSFERED_FLAG,
gbc.DOCUMENT_TYPE,
gbc.EXPENDITURE_ORGANIZATION_ID,
gbc.PERIOD_NAME,
gbc.PERIOD_YEAR,
gbc.PERIOD_NUM,
gbc.DOCUMENT_HEADER_ID ,
gbc.DOCUMENT_DISTRIBUTION_ID,
gbc.TOP_TASK_ID,
gbc.BUDGET_VERSION_ID,
gbc.BUD_TASK_ID, -- Bug 3338999
gbc.RESOURCE_LIST_MEMBER_ID,
gbc.ACCOUNT_TYPE,
-- Bug 1980810 PA Rounding function added
pa_currency.round_currency_amt(decode(nvl(entered_dr,0),0,0,((nvl(gbc.BURDENABLE_RAW_COST ,0)) * nvl(cm.compiled_multiplier,0)))),
pa_currency.round_currency_amt(decode(nvl(entered_cr,0),0,0,((nvl(gbc.BURDENABLE_RAW_COST ,0)) * nvl(cm.compiled_multiplier,0)))),
gbc.TOLERANCE_AMOUNT,
gbc.TOLERANCE_PERCENTAGE,
gbc.OVERRIDE_AMOUNT,
gbc.EFFECT_ON_FUNDS_CODE ,
gbc.RESULT_CODE,
gbc.GL_BC_PACKETS_ROWID,
gms_bc_packets_s.nextval,
gbc.BC_PACKET_ID,
gbc.vendor_id
from pa_ind_rate_sch_revisions irsr,
pa_cost_bases cb,
pa_expenditure_types et,
pa_ind_cost_codes icc,
pa_cost_base_exp_types cbet,
pa_ind_rate_schedules_all_bg irs,
pa_ind_compiled_sets ics,
pa_compiled_multipliers cm,
gms_bc_packets gbc
where irsr.cost_plus_structure = cbet.cost_plus_structure
and cb.cost_base = cbet.cost_base
and cb.cost_base_type = cbet.cost_base_type
and ics.cost_base = cbet.cost_base --Bug 3003584
and et.expenditure_type = icc.expenditure_type
and icc.ind_cost_code = cm.ind_cost_code
and cbet.cost_base = cm.cost_base
and cbet.cost_base_type = 'INDIRECT COST'
and cbet.expenditure_type = gbc.expenditure_type
and irs.ind_rate_sch_id = irsr.ind_rate_sch_id
and ics.ind_rate_sch_revision_id = irsr.ind_rate_sch_revision_id
and ics.organization_id = gbc.expenditure_organization_id
and gbc.document_type = 'EXP'
and ics.ind_compiled_set_id = gms_cost_plus_extn.AWARD_CMT_COMPILED_SET_ID( gbc.DOCUMENT_HEADER_ID ,
gbc.DOCUMENT_DISTRIBUTION_ID,
gbc.task_id,
gbc.document_type,
gbc.expenditure_item_date,
gbc.expenditure_type, --Bug 3003584
gbc.expenditure_organization_id,
'C',
gbc.award_id )
and cm.ind_compiled_set_id = ics.ind_compiled_set_id
and cm.compiled_multiplier <> 0 -- Fix for Bug 806481
and gbc.packet_id = x_packet_id ;
gms_cost_plus_extn.update_exp_rev_cat (x_packet_id);
gms_cost_plus_extn.update_top_tsk_par_res (x_packet_id);
SELECT count(*)
into x_err_code
FROM DUAL
WHERE exists ( select 'X' from gms_bc_packets
where packet_id = x_packet_id
and substr(nvl(result_code, 'P'),1,1) = 'F' );
select gl_accounted_flag ,
pre_processing_extension -- Bug 3035863
from pa_transaction_sources
where transaction_source = X_transaction_source ;
SELECT budget_version_id
from gms_budget_versions
where project_id = x_project_id
and award_id = x_award_id
and budget_status_code = 'B'
and current_flag = 'Y' ;
select 1
from gms_award_exp_type_act_cost
where award_id = x_award_id
and expenditure_type = x_exp_type ;
select 1
from gms_bc_packets
where status_code = 'A'
and award_id = x_award_id
and expenditure_type = x_exp_type ;
select adl.award_id
from gms_award_distributions adl,
ap_invoice_distributions_all apd
where apd.award_id = adl.award_set_id
and adl.adl_line_num = 1
and adl.adl_status = 'A'
and apd.invoice_id = to_number(x_invoice_id)
-- AP Lines uptake: use invoice_distribution_id instead of distribution_line_number
and apd.invoice_distribution_id = x_inv_dist_id
and adl.document_type = 'AP'
and apd.invoice_id = NVL( adl.invoice_id, 0)
-- AP Lines uptake: use invoice_distribution_id instead of distribution_line_number
and apd.invoice_distribution_id = NVL ( adl.invoice_distribution_id, 0)
union /* BUG 14216205 : Added the union for SAT */
select adl.award_id
from GMS_AWARD_DISTRIBUTIONS ADL,
AP_SELF_ASSESSED_TAX_DIST_ALL apsat
where apsat.award_id = adl.award_set_id
and adl.adl_line_num = 1
and adl.adl_status = 'A'
and apsat.invoice_id = to_number(x_invoice_id)
and apsat.invoice_distribution_id = x_inv_dist_id
and adl.document_type = 'AP'
and APSAT.INVOICE_ID = NVL( ADL.INVOICE_ID, 0)
and apsat.invoice_distribution_id = NVL ( adl.invoice_distribution_id, 0) ;
Select Allowable_Schedule_Id,
nvl(Preaward_Date,START_DATE_ACTIVE) preaward_date,
End_Date_Active end_date,
Close_Date close_date,
Status
from GMS_AWARDS
where award_id = l_award_id;
SELECT txn.project_id project_id,
txn.task_id task_id,
txn.project_number project_number,
txn.task_number task_number,
txn.expenditure_type expenditure_type,
txn.expenditure_item_date expenditure_item_date,
txn.cdl_system_reference2 invoice_id,
-- AP Lines uptake: use invoice_distribution_id instead of distribution_line_number
txn.cdl_system_reference5 invoice_distribution_id,
txn.system_linkage system_linkage,
Gtxn.award_id award_id,
-- Bug 3221039 and 3035863 : Added below columns
gtxn.award_number award_number,
txn.transaction_source transaction_source,
txn.batch_name batch_name,
GTXN.txn_interface_id txn_interface_id
FROM gms_transaction_interface_all Gtxn,
pa_transaction_interface_all txn
WHERE txn.txn_interface_id = X_txn_interface_id
AND txn.txn_interface_id = Gtxn.txn_interface_id (+) ;
select project_id
from pa_projects_all
where segment1 = l_project_number ;
select segment1
from pa_projects_all
where project_id = l_project_id ;
select task_id
from pa_tasks
where task_number = l_task_number
and project_id = l_project_id ;
select task_number
from pa_tasks
where task_id = l_task_id ;
UPDATE PA_TRANSACTION_INTERFACE_ALL
SET transaction_rejection_code = X_status ,
transaction_status_code = 'PR'
where TXN_INTERFACE_ID = x_txn_interface_id
and batch_name = X_batch_name
and transaction_source=x_txn_source ;
UPDATE PA_TRANSACTION_INTERFACE_ALL
SET transaction_rejection_code = X_status ,
transaction_status_code = 'R'
where TXN_INTERFACE_ID = x_txn_interface_id
and batch_name = X_batch_name
and transaction_source=x_txn_source ;
SELECT award_id
FROM gms_award_distributions
WHERE award_set_id = x_award_set_id
AND adl_status = 'A'
and adl_line_num = 1 ;
SELECT award_id
FROM gms_award_distributions
WHERE award_set_id = x_award_set_id
AND adl_status = 'A'
AND document_type = 'PO'
and adl_line_num = 1 ;
select nvl(sponsored_flag,'N')
into l_sponsored_flag
from pa_tasks t,
pa_projects_all p,
gms_project_types gpt
where p.project_id = t.project_id
and gpt.project_type = p.project_type
and t.task_id = nvl(p_task_id,0);
-- cdl_system_reference5 was added to the select for invoice distribution ID
--
select pti.transaction_source,
pti.system_linkage,
pti.cdl_system_reference2,
pti.cdl_system_reference3,
pti.cdl_system_reference5,
pts.predefined_flag
into l_transaction_source,
l_system_linkage,
l_system_reference2,
l_system_reference3,
l_system_reference5,
l_predefined_flag
from pa_transaction_interface_all pti,
pa_transaction_sources pts
where pti.txn_interface_id = p_tran_item_id
and pti.transaction_source = pts.transaction_source ;
/*select adl.award_id
into l_award_id
from gms_Award_distributions adl,
ap_invoice_distributions_all apd
where apd.invoice_id = l_system_reference2
and apd.invoice_distribution_id = l_system_reference5
and apd.invoice_id = adl.invoice_id
and apd.invoice_distribution_id = adl.invoice_distribution_id
and apd.award_id = adl.award_set_id
and adl.adl_status = 'A'
and adl.document_type = 'AP'
and adl.adl_line_num = 1
and rownum = 1;*/
select adl.award_id
into l_award_id
from gms_Award_distributions adl,
ap_invoice_distributions_all apd
where apd.invoice_id = l_system_reference2
and apd.invoice_distribution_id = l_system_reference5
and apd.invoice_id = adl.invoice_id
and apd.invoice_distribution_id = adl.invoice_distribution_id
and apd.award_id = adl.award_set_id
and adl.adl_status = 'A'
and adl.document_type = 'AP'
and ADL.ADL_LINE_NUM = 1
and rownum = 1;
select ADL.AWARD_ID
into l_award_id
from GMS_AWARD_DISTRIBUTIONS ADL,
AP_SELF_ASSESSED_TAX_DIST_ALL APSAT
where APSAT.INVOICE_ID = l_system_reference2
and apsat.invoice_distribution_id = l_system_reference5
and apsat.invoice_id = adl.invoice_id
and apsat.invoice_distribution_id = adl.invoice_distribution_id
and apsat.award_id = adl.award_set_id
and adl.adl_status = 'A'
and adl.document_type = 'AP'
and ADL.ADL_LINE_NUM = 1
and rownum = 1;
select awd.award_id
into l_award_id
from gms_transaction_interface_all gti,
gms_awards_all awd
where gti.txn_interface_id = p_tran_item_id
and NVL(gti.award_id, awd.award_id) = awd.award_id
and NVL(gti.award_number, awd.award_number ) = awd.award_number
and ( gti.award_id is NOT NULL OR gti.award_number is NOT NULL
) ;
select adl.award_id
into l_award_id
from gms_Award_distributions adl
where adl.expenditure_item_id = p_tran_item_id
and adl.adl_status = 'A'
and adl.document_type = 'EXP'
and adl.adl_line_num = 1
and rownum = 1;
select aw.status, aw.close_date
into l_award_status ,l_close_date
from gms_award_distributions adl ,gms_awards_all aw
where adl.expenditure_item_id = x_expenditure_item_id
and adl.adl_status = 'A'
and adl.document_type = nvl(x_doc_type, 'EXP') --Bug 5726575
and adl.award_id = aw.award_id
and rownum = 1 ;
select t.project_id into l_project_id
from pa_tasks t
where t.task_id = x_task_id ;
SELECT AWARD_ID
FROM GMS_AWARD_DISTRIBUTIONS
WHERE EXPENDITURE_ITEM_ID = p_expenditure_item_id
AND ADL_LINE_NUM = 1
AND DOCUMENT_TYPE = 'EXP'
AND ADL_STATUS = 'A';
SELECT a.award_number
INTO l_award_number
FROM gms_awards_all a
, gms_award_distributions adl
WHERE adl.award_id = a.award_id
AND adl.expenditure_item_id = p_expenditure_item_id
AND adl.adl_line_num = 1
AND adl.adl_status = 'A'
AND adl.document_type = 'EXP';
SELECT default_dist_award_id
into x_default_dist_award_id
from gms_implementations ;