The following lines contain the word 'select', 'insert', 'update' or 'delete':
select
nvl(per_jobs.approval_authority, 0),
per_all_assignments_f.supervisor_id
into
jobLevelOut,
supervisorIdOut
from
per_jobs,
per_all_assignments_f
where
per_jobs.job_id = per_all_assignments_f.job_id and
per_all_assignments_f.person_id = personIdIn and
per_all_assignments_f.primary_flag = 'Y' and
per_all_assignments_f.assignment_type in ('E','C') and
per_all_assignments_f.assignment_status_type_id not in
(select assignment_status_type_id
from per_assignment_status_types
where per_system_status = 'TERM_ASSIGN') and
trunc(sysdate) between
per_all_assignments_f.effective_start_date and
per_all_assignments_f.effective_end_date;
/* Update hasFinalAuthorityYN as needed. */
if(not tempRuleSatisfied and
hasFinalAuthorityYN = ame_util.booleanTrue) then
hasFinalAuthorityYN := ame_util.booleanFalse;
/* Update source. */
ame_util.appendRuleIdToSource(ruleIdIn => ruleIds(i),
sourceInOut => source);
/* Update category as needed. */
if(category = ame_util.fyiApproverCategory and
approverCategories(i) = ame_util.approvalApproverCategory) then
category := ame_util.approvalApproverCategory;
COAInsertee ame_util.approverRecord2;
nameOut => COAInsertee.name,
origSystemOut => COAInsertee.orig_system,
origSystemIdOut => COAInsertee.orig_system_id,
displayNameOut => COAInsertee.display_name,
sourceOut => COAInsertee.source);
if(COAInsertee.name is null) then
/* Check to see if job_level_non_default_starting_point_person_id is defined */
startingPointId :=
to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.jobLevelStartingPointAttribute));
/* Check if requestor can self approve. If so, insert the approver as the only approver, with a status
of approved, and return.*/
if(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.allowAutoApprovalAttribute)
= ame_util.booleanAttributeTrue)
then
getCatSourceAndAuthority(personIdIn => requestorId,
jobLevelIn => tempJobLevel,
supervisorIdIn => tempSupervisorId,
categoryOut => tempApprover.approver_category,
sourceOut => tempApprover.source,
hasFinalAuthorityYNOut => tempHasFinalAuthorityYN,
supervisorJobLevelOut => tempSupervisorJobLevel,
nextSupervisorIdOut => tempNextSupervisorId);
tempApprover.api_insertion := ame_util.oamGenerated;
tempApprover.api_insertion := ame_util.oamGenerated;
else /* COA firstAuthority insertion found */
/* assign tempApprover with appropriate values */
tempApprover.name := COAInsertee.name;
tempApprover.orig_system := COAInsertee.orig_system;
tempApprover.orig_system_id := COAInsertee.orig_system_id;
tempApprover.display_name := COAInsertee.display_name;
firstApproverSource := COAInsertee.source;
tempApprover.api_insertion := ame_util.apiAuthorityInsertion;
/* reassign the value of source in case approver was a firstAuthority insertee */
if firstApproverSource is not null then
tempApprover.source := firstApproverSource;
/* check to see if there is a COA insertion after this approver. If a COA insertion is
found, keep checking till no more COA insertions. The check for final authority will need to be
done again.
*/
loop
/* Initialize COAInsertee approverRecord2 */
COAInsertee := ame_util.emptyApproverRecord2;
/* Check if there are any COAInsertions */
ame_engine.getHandlerCOAInsertion(nameIn => tempApprover.name,
itemClassIn => tempApprover.item_class,
itemIdIn => tempApprover.item_id,
actionTypeIdIn => tempApprover.action_type_id,
groupOrChainIdIn => tempApprover.group_or_chain_id,
occurrenceIn => tempApprover.occurrence,
approvalStatusIn => tempApprover.approval_status,
nameOut => COAInsertee.name,
origSystemOut => COAInsertee.orig_system,
origSystemIdOut => COAInsertee.orig_system_id,
displayNameOut => COAInsertee.display_name,
sourceOut => COAInsertee.source);
if COAInsertee.name is null then
exit;
tempApprover.name := COAInsertee.name;
tempApprover.orig_system := COAInsertee.orig_system;
tempApprover.orig_system_id := COAInsertee.orig_system_id;
tempApprover.display_name := COAInsertee.display_name;
tempApprover.source := COAInsertee.source;
tempApprover.api_insertion := ame_util.apiAuthorityInsertion;