The following lines contain the word 'select', 'insert', 'update' or 'delete':
/* To Update Audit Procedure Results */
PROCEDURE update_apr(
errbuf OUT NOCOPY VARCHAR2
,retcode OUT NOCOPY VARCHAR2
,p_batch_id IN NUMBER
,p_user_id IN NUMBER
)
IS
-- Audit Procedure Id
CURSOR c_apid IS
SELECT ap_name,audit_project_id,organization_id,task_id from amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id);
SELECT audit_procedure_id,audit_project_id,organization_id,task_id,control_id from amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id);
SELECT audit_project_name,audit_project_startdate from amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id);
SELECT control_name,control_description,audit_project_id,task_id,audit_procedure_id,organization_id from amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id)
and control_name is not null;
SELECT task_name,audit_project_id from amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id);
SELECT organization_name,audit_project_id,task_id from amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id);
SELECT step_name,step_number,audit_procedure_id,audit_procedure_rev_id from amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id)
and step_name is not null;
SELECT ap_status,ap_work_description,ap_executedby_name,
ap_executed_on,audit_procedure_id,audit_procedure_rev_id,
audit_project_id,task_id,organization_id,ap_interface_id
FROM amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id);
SELECT step_status,step_work_description,step_executedby_name,
step_executed_on,ap_interface_id,audit_procedure_id,
audit_procedure_rev_id,audit_project_id,task_id,organization_id,step_id
FROM amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id)
and step_id <> 0;
SELECT design_effectiveness,op_effectiveness,control_opinion,
ctrl_overall_summary,ctrl_overall_description,
ctrl_design_summary,ctrl_design_description,
ctrl_operating_summary,ctrl_operating_description,
audit_procedure_id,audit_procedure_rev_id,
audit_project_id,task_id,organization_id,ap_interface_id,control_id
FROM amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id)
and control_id <> 0;
SELECT step_id, audit_procedure_rev_id, task_id,audit_project_id,organization_id,
steps_attachment_url
FROM amw_audit_procedure_interface
WHERE created_by = DECODE (p_user_id, NULL, created_by, p_user_id)
AND batch_id = DECODE (p_batch_id, NULL, batch_id, p_batch_id)
and step_id <> 0;
select aecv.party_id into v_party_id
from AMW_EMPLOYEES_CURRENT_V aecv, FND_USER fu
where aecv.EMPLOYEE_ID = fu.EMPLOYEE_ID
and fu.user_id = G_USER_ID;
update amw_audit_procedure_interface set control_id = 0,task_id = 0,organization_id = 0,
audit_project_id = 0,audit_procedure_id = 0,audit_procedure_rev_id = 0,step_id = 0
where created_by = p_user_id and batch_id = p_batch_id;
update amw_audit_procedure_interface set AP_INTERFACE_ID= amw_audit_procedure_int_s.nextval where AP_INTERFACE_ID = 0
and batch_id = p_batch_id;
select audit_project_id into v_audit_project_id from amw_audit_projects_v
where substr(to_char(start_date),1,11) = substr(to_char(projid_rec.audit_project_startdate),1,11) and project_name = projid_rec.audit_project_name
and template_flag = 'N';
update amw_audit_procedure_interface set audit_project_id = v_audit_project_id
where audit_project_name = projid_rec.audit_project_name and batch_id = p_batch_id;
select task_id into v_task_id from amw_audit_tasks_v where task_name = taskid_rec.task_name
and audit_project_id = taskid_rec.audit_project_id;
update amw_audit_procedure_interface set task_id = v_task_id
where task_name = taskid_rec.task_name
and audit_project_id = taskid_rec.audit_project_id and batch_id = p_batch_id;
select organization_id into v_org_id from amw_audit_units_v
where name = orgid_rec.organization_name and organization_id in (select pk2 from amw_ap_associations
where pk1 = orgid_rec.audit_project_id and object_type = 'PROJECT' and pk4 = orgid_rec.task_id);
update amw_audit_procedure_interface set organization_id = v_org_id
where organization_name = orgid_rec.organization_name and batch_id = p_batch_id
and audit_project_id = orgid_rec.audit_project_id and task_id = orgid_rec.task_id;
select audit_procedure_id into v_audit_procedure_id from amw_audit_procedures_vl where curr_approved_flag = 'Y'
and name = apid_rec.ap_name and audit_procedure_id in (select audit_procedure_id from amw_ap_associations
where object_type = 'PROJECT' and pk4 = apid_rec.task_id and pk1 = apid_rec.audit_project_id and pk2 = apid_rec.organization_id);
update amw_audit_procedure_interface set audit_procedure_id = v_audit_procedure_id
where ap_name = apid_rec.ap_name and batch_id = p_batch_id
and task_id = apid_rec.task_id and audit_project_id = apid_rec.audit_project_id
and organization_id = apid_rec.organization_id;
select control_id into v_ctrl_id from amw_controls_b acb, amw_controls_tl act
where act.language(+)= userenv('LANG') and act.name = ctrlid_rec.control_name and act.description = ctrlid_rec.control_description
and act.control_rev_id = acb.control_rev_id and acb.curr_approved_flag = 'Y' and acb.control_id in (select pk3 from amw_ap_associations
where object_type = 'PROJECT' and pk1 = ctrlid_rec.audit_project_id and pk2 = ctrlid_rec.organization_id and
pk4 = ctrlid_rec.task_id and audit_procedure_id = ctrlid_rec.audit_procedure_id);
update amw_audit_procedure_interface set control_id = v_ctrl_id
where control_name = ctrlid_rec.control_name and control_description = ctrlid_rec.control_description
and batch_id = p_batch_id and audit_project_id = ctrlid_rec.audit_project_id
and task_id = ctrlid_rec.task_id and organization_id = ctrlid_rec.organization_id;
select distinct audit_procedure_rev_id into v_audit_procedure_rev_id from amw_AP_associations
where audit_procedure_id = aprevid_rec.audit_procedure_id and pk1 = aprevid_rec.audit_project_id
and pk2 = aprevid_rec.organization_id and pk4 = aprevid_rec.task_id
and object_type = 'PROJECT';
update amw_audit_procedure_interface set audit_procedure_rev_id = v_audit_procedure_rev_id
where audit_procedure_id = aprevid_rec.audit_procedure_id and batch_id = p_batch_id
and task_id = aprevid_rec.task_id and audit_project_id = aprevid_rec.audit_project_id
and organization_id = aprevid_rec.organization_id and control_id = aprevid_rec.control_id;
select ap_step_id into v_step_id from amw_ap_steps_vl aasv, amw_audit_procedures_vl ap
where aasv.name = stepid_rec.step_name and aasv.cseqnum = stepid_rec.step_number
and aasv.audit_procedure_id = stepid_rec.audit_procedure_id
and ap.audit_procedure_rev_id = stepid_rec.audit_procedure_rev_id
and ap.audit_procedure_id = stepid_rec.audit_procedure_id
and ap.audit_procedure_rev_num >= aasv.from_rev_num
and ap.audit_procedure_rev_num < NVL(aasv.to_rev_num, ap.audit_procedure_rev_num + 1) ;
update amw_audit_procedure_interface set step_id = v_step_id
where step_name = stepid_rec.step_name and step_number = stepid_rec.step_number
and audit_procedure_id = stepid_rec.audit_procedure_id and batch_id = p_batch_id;
select person_party_id into v_emp_id from fnd_user where user_id = g_user_id;
update_interface_with_error(v_error_msg,ap_details_rec.ap_interface_id);
select count(*) into v_ap_cnt from amw_ap_executions
where audit_procedure_rev_id = ap_details_rec.audit_procedure_rev_id
and pk1 = ap_details_rec.audit_project_id and pk2 = ap_details_rec.organization_id
and pk3 = ap_details_rec.task_id and execution_type = 'AP';
insert into amw_ap_executions
(execution_id,audit_procedure_rev_id,last_update_date,
last_updated_by,creation_date,created_by,
last_update_login,executed_on,executed_by,
status,work_desc,execution_type,pk1,pk2,pk3,object_version_number)
values(amw_ap_executions_s.nextval,ap_details_rec.audit_procedure_rev_id,sysdate,
g_user_id,sysdate,g_user_id,
g_login_id,sysdate,v_emp_id,
ap_details_rec.ap_status,ap_details_rec.ap_work_description,
'AP',ap_details_rec.audit_project_id,ap_details_rec.organization_id,
ap_details_rec.task_id,1);
update amw_ap_executions set work_desc = ap_details_rec.ap_work_description,
status = ap_details_rec.ap_status,executed_by = v_emp_id,
executed_on = sysdate
where audit_procedure_rev_id = ap_details_rec.audit_procedure_rev_id
and pk1 = ap_details_rec.audit_project_id and pk2 = ap_details_rec.organization_id
and pk3 = ap_details_rec.task_id and execution_type = 'AP';
update_interface_with_error(v_error_msg,step_details_rec.ap_interface_id);
update_interface_with_error(v_error_msg,step_details_rec.ap_interface_id);
select count(*) into v_step_cnt from amw_ap_executions
where audit_procedure_rev_id = step_details_rec.audit_procedure_rev_id
and pk1 = step_details_rec.audit_project_id and pk2 = step_details_rec.organization_id
and pk3 = step_details_rec.task_id and execution_type = 'STEP'
and ap_step_id = step_details_rec.step_id;
insert into amw_ap_executions
(execution_id,audit_procedure_rev_id,ap_step_id,
last_update_date,last_updated_by,creation_date,created_by,
last_update_login,executed_on,executed_by,
status,work_desc,execution_type,pk1,pk2,pk3,object_version_number)
values(amw_ap_executions_s.nextval,step_details_rec.audit_procedure_rev_id,step_details_rec.step_id,
sysdate,g_user_id,sysdate,g_user_id,
g_login_id,sysdate,v_emp_id,
step_details_rec.step_status,step_details_rec.step_work_description,
'STEP',step_details_rec.audit_project_id,step_details_rec.organization_id,
step_details_rec.task_id,1);
update amw_ap_executions set work_desc = step_details_rec.step_work_description,
status = step_details_rec.step_status,executed_by = v_emp_id,
executed_on = sysdate
where audit_procedure_rev_id = step_details_rec.audit_procedure_rev_id
and pk1 = step_details_rec.audit_project_id and pk2 = step_details_rec.organization_id
and pk3 = step_details_rec.task_id and execution_type = 'STEP'
and ap_step_id = step_details_rec.step_id;
select count(*) into v_steps_attach_cnt from fnd_documents_tl where document_id in (
SELECT document_id FROM FND_ATTACHED_DOCUMENTS WHERE ENTITY_NAME='AMW_PROJECT_STEP'
AND PK1_VALUE = step_attach_rec.audit_project_id
AND PK2_VALUE = step_attach_rec.organization_id
AND PK3_VALUE = step_attach_rec.task_id AND PK4_VALUE = step_attach_rec.audit_procedure_rev_id
AND PK5_VALUE = step_attach_rec.step_id) and file_name = step_attach_rec.steps_attachment_url
and language(+)= userenv('LANG');
SELECT MAX(SEQ_NUM) INTO L_SEQ_NUM FROM FND_ATTACHED_DOCUMENTS WHERE ENTITY_NAME='AMW_PROJECT_STEP'
AND PK1_VALUE = step_attach_rec.audit_project_id
AND PK2_VALUE = step_attach_rec.organization_id
AND PK3_VALUE = step_attach_rec.task_id AND PK4_VALUE = step_attach_rec.audit_procedure_rev_id
AND PK5_VALUE = step_attach_rec.step_id;
select opinion_component_id into v_overall from amw_opinion_componts_b
where opinion_component_code = 'OVERALL' and object_opinion_type_id =
(select object_opinion_type_id from AMW_OBJECT_OPINION_TYPES where object_id =
(select object_id from fnd_objects where obj_name = 'AMW_ORG_AP_CONTROL'));
select opinion_component_id into v_design from amw_opinion_componts_b
where opinion_component_code = 'DESIGN' and object_opinion_type_id =
(select object_opinion_type_id from AMW_OBJECT_OPINION_TYPES where object_id =
(select object_id from fnd_objects where obj_name = 'AMW_ORG_AP_CONTROL'));
select opinion_component_id into v_operating from amw_opinion_componts_b
where opinion_component_code = 'OPERATING' and object_opinion_type_id =
(select object_opinion_type_id from AMW_OBJECT_OPINION_TYPES where object_id =
(select object_id from fnd_objects where obj_name = 'AMW_ORG_AP_CONTROL'));
select object_opinion_type_id into v_opinion_object_id from AMW_OBJECT_OPINION_TYPES
where opinion_type_id = (select opinion_type_id from AMW_OPINION_TYPES_b
where opinion_type_code = 'EVALUATION') and object_id = (select object_id from
fnd_objects where obj_name = 'AMW_ORG_AP_CONTROL');
update_interface_with_error(v_error_msg,eff_details_rec.ap_interface_id);
select count(*) into v_opinions_cnt from amw_opinions where
pk1_value = eff_details_rec.control_id and pk2_value = eff_details_rec.audit_project_id and
pk3_value = eff_details_rec.organization_id and pk4_value = eff_details_rec.audit_procedure_id and
pk5_value = eff_details_rec.task_id;
select opinion_id into v_opinions_upd_id from amw_opinions where
pk1_value = eff_details_rec.control_id and pk2_value = eff_details_rec.audit_project_id and
pk3_value = eff_details_rec.organization_id and pk4_value = eff_details_rec.audit_procedure_id and
pk5_value = eff_details_rec.task_id;
update amw_opinion_details set opinion_value_id =eff_details_rec.control_opinion,
summary_txt = eff_details_rec.ctrl_overall_summary,
description_txt = eff_details_rec.ctrl_overall_description
where opinion_id = v_opinions_upd_id and opinion_component_id = v_overall;
update amw_opinion_details set opinion_value_id =eff_details_rec.design_effectiveness,
summary_txt = eff_details_rec.ctrl_design_summary,
description_txt = eff_details_rec.ctrl_design_description
where opinion_id = v_opinions_upd_id and opinion_component_id = v_design;
update amw_opinion_details set opinion_value_id =eff_details_rec.op_effectiveness,
summary_txt = eff_details_rec.ctrl_operating_summary,
description_txt = eff_details_rec.ctrl_operating_description
where opinion_id = v_opinions_upd_id and opinion_component_id = v_operating;
select AMW_OPINIONS_S2.nextval into v_opinion_id from dual;
-- Inserting into amw_opinions table
INSERT into amw_opinions(opinion_set_id,opinion_id,object_opinion_type_id,pk1_value,pk2_value,
pk3_value,pk4_value,pk5_value,party_id,authored_by,authored_date,last_update_date,last_updated_by,
creation_date,created_by,last_update_login) values
(AMW_OPINIONS_S1.nextval,v_opinion_id,v_opinion_object_id,eff_details_rec.control_id,eff_details_rec.audit_project_id,
eff_details_rec.organization_id,eff_details_rec.audit_procedure_id,eff_details_rec.task_id,v_party_id,G_LOGIN_ID,sysdate,sysdate,G_USER_ID,
sysdate,G_USER_ID,G_LOGIN_ID);
-- Inserting into amw_opinion_details table
INSERT into amw_opinion_details(opinion_detail_id,opinion_id,opinion_component_id,opinion_value_id,
last_update_date,last_updated_by,creation_date,created_by,last_update_login,object_version_number
,summary_txt,description_txt) values
(AMW_OPINION_DETAILS_S1.nextval,v_opinion_id,v_overall,eff_details_rec.control_opinion,
sysdate,G_USER_ID,sysdate,G_USER_ID,G_LOGIN_ID,1,eff_details_rec.ctrl_overall_summary,eff_details_rec.ctrl_overall_description);
INSERT into amw_opinion_details(opinion_detail_id,opinion_id,opinion_component_id,opinion_value_id,
last_update_date,last_updated_by,creation_date,created_by,last_update_login,object_version_number
,summary_txt,description_txt) values
(AMW_OPINION_DETAILS_S1.nextval,v_opinion_id,v_design,eff_details_rec.design_effectiveness,
sysdate,G_USER_ID,sysdate,G_USER_ID,G_LOGIN_ID,1,eff_details_rec.ctrl_design_summary,eff_details_rec.ctrl_design_description);
INSERT into amw_opinion_details(opinion_detail_id,opinion_id,opinion_component_id,opinion_value_id,
last_update_date,last_updated_by,creation_date,created_by,last_update_login,object_version_number
,summary_txt,description_txt) values
(AMW_OPINION_DETAILS_S1.nextval,v_opinion_id,v_operating,eff_details_rec.op_effectiveness,
sysdate,G_USER_ID,sysdate,G_USER_ID,G_LOGIN_ID,1,eff_details_rec.ctrl_operating_summary,eff_details_rec.ctrl_operating_description);
-- Inserting into Opinion Log Tables
select AMW_OPINIONS_LOG_S.nextval into v_opinion_log_id from dual;
select opinion_id into v_opinions_logid from amw_opinions where
pk1_value = eff_details_rec.control_id and pk2_value = eff_details_rec.audit_project_id and
pk3_value = eff_details_rec.organization_id and pk4_value = eff_details_rec.audit_procedure_id and
pk5_value = eff_details_rec.task_id;
select opinion_set_id into v_opinions_set_logid from amw_opinions where
pk1_value = eff_details_rec.control_id and pk2_value = eff_details_rec.audit_project_id and
pk3_value = eff_details_rec.organization_id and pk4_value = eff_details_rec.audit_procedure_id and
pk5_value = eff_details_rec.task_id;
select opinion_detail_id into v_overall_detail_logid from amw_opinion_details
where opinion_id = v_opinions_logid and opinion_component_id = v_overall;
select opinion_detail_id into v_design_detail_logid from amw_opinion_details
where opinion_id = v_opinions_logid and opinion_component_id = v_design;
select opinion_detail_id into v_operating_detail_logid from amw_opinion_details
where opinion_id = v_opinions_logid and opinion_component_id = v_operating;
-- Inserting into amw_opinions_log table
INSERT into amw_opinions_log(opinion_log_id,opinion_set_id,opinion_id,object_opinion_type_id,pk1_value,pk2_value,
pk3_value,pk4_value,pk5_value,party_id,authored_by,authored_date,last_update_date,last_updated_by,
creation_date,created_by,last_update_login) values
(v_opinion_log_id,v_opinions_set_logid,v_opinions_logid,v_opinion_object_id,eff_details_rec.control_id,eff_details_rec.audit_project_id,
eff_details_rec.organization_id,eff_details_rec.audit_procedure_id,eff_details_rec.task_id,v_party_id,G_LOGIN_ID,sysdate,sysdate,G_USER_ID,
sysdate,G_USER_ID,G_LOGIN_ID);
-- Inserting into amw_opinion_log_details table
INSERT into amw_opinion_log_details(opinion_log_id,opinion_detail_id,opinion_id,opinion_component_id,opinion_value_id,
last_update_date,last_updated_by,creation_date,created_by,last_update_login,object_version_number
,summary_txt,description_txt,opinion_log_detail_id) values
(v_opinion_log_id,v_overall_detail_logid,v_opinions_logid,v_overall,eff_details_rec.control_opinion,
sysdate,G_USER_ID,sysdate,G_USER_ID,G_LOGIN_ID,1,eff_details_rec.ctrl_overall_summary,eff_details_rec.ctrl_overall_description
,AMW_OPINION_LOG_DETAILS_S.nextval);
INSERT into amw_opinion_log_details(opinion_log_id,opinion_log_detail_id,opinion_detail_id,opinion_id,opinion_component_id,opinion_value_id,
last_update_date,last_updated_by,creation_date,created_by,last_update_login,object_version_number
,summary_txt,description_txt) values
(v_opinion_log_id,AMW_OPINION_LOG_DETAILS_S.nextval,v_design_detail_logid,v_opinions_logid,v_design,eff_details_rec.design_effectiveness,
sysdate,G_USER_ID,sysdate,G_USER_ID,G_LOGIN_ID,1,eff_details_rec.ctrl_design_summary,eff_details_rec.ctrl_design_description);
INSERT into amw_opinion_log_details(opinion_log_id,opinion_log_detail_id,opinion_detail_id,opinion_id,opinion_component_id,opinion_value_id,
last_update_date,last_updated_by,creation_date,created_by,last_update_login,object_version_number
,summary_txt,description_txt) values
(v_opinion_log_id,AMW_OPINION_LOG_DETAILS_S.nextval,v_operating_detail_logid,v_opinions_logid,v_operating,eff_details_rec.op_effectiveness,
sysdate,G_USER_ID,sysdate,G_USER_ID,G_LOGIN_ID,1,eff_details_rec.ctrl_operating_summary,eff_details_rec.ctrl_operating_description);
delete from amw_audit_procedure_interface where batch_id = p_batch_id;
fnd_file.put_line (fnd_file.LOG,'Error in update '||SUBSTR (SQLERRM, 1, 200));
END update_apr;
PROCEDURE update_interface_with_error (
p_err_msg IN VARCHAR2
,p_interface_id IN NUMBER
)
IS
l_interface_status amw_audit_procedure_interface.interface_status%TYPE;
ROLLBACK; -- rollback any inserts done during the current loop process
SELECT interface_status
INTO l_interface_status
FROM amw_audit_procedure_interface
WHERE ap_interface_id = p_interface_id;
UPDATE amw_audit_procedure_interface
SET interface_status =
l_interface_status
|| p_err_msg
,error_flag = 'Y'
WHERE ap_interface_id = p_interface_id;
END update_interface_with_error;
SELECT FND_ATTACHED_DOCUMENTS_S.nextval
FROM dual;
SELECT 1
FROM FND_ATTACHED_DOCUMENTS
WHERE document_id = l_id;
AMW_UTILITY_PVT.debug_message( 'Private API: Calling table handler fnd_documents_pkg.insert_row');
fnd_documents_pkg.insert_row(
X_rowid => l_row_id,
X_document_id => x_document_id,
X_creation_date => sysdate,
X_created_by => FND_GLOBAL.USER_ID,
X_last_update_date => sysdate,
X_last_updated_by => FND_GLOBAL.USER_ID,
X_last_update_login => FND_GLOBAL.CONC_LOGIN_ID,
X_datatype_id => p_Fnd_Attachment_rec.datatype_id,
X_category_id => p_Fnd_Attachment_rec.category_id,
X_security_type => p_Fnd_Attachment_rec.security_type,
X_publish_flag => p_Fnd_Attachment_rec.publish_flag,
X_usage_type => p_Fnd_Attachment_rec.usage_type,
X_language => p_Fnd_Attachment_rec.language,
X_description =>p_Fnd_Attachment_rec.description,
X_file_name => p_Fnd_Attachment_rec.file_name,
X_media_id => l_media_id
);
insert into
fnd_documents_short_text
(media_id,
short_text
)
values
(l_media_id,
p_Fnd_Attachment_rec.short_text
);
Update fnd_documents_tl because FND_API inserts newly generated
media_id into that table.
*/
update fnd_documents_tl
set media_id = p_Fnd_Attachment_rec.media_id
where document_id = x_document_id;
/* For File we have already generated a file id - the fnd_documents_pkg.insert_row
table handler has generated a fnd_lobs_s.nextval but that's not what shoule be the
reference to the FND_LOBS table - because the upload program has already generated a
sequence */
/**
update fnd_documents_tl
set media_id = p_Fnd_Attachment_rec.media_id
where document_id = l_document_id;
fnd_attached_documents_pkg.Insert_Row
( x_rowid => l_row_id,
X_attached_document_id => l_attached_document_ID,
X_document_id => x_document_ID,
X_creation_date => sysdate,
X_created_by => FND_GLOBAL.USER_ID,
X_last_update_date => sysdate,
X_last_updated_by => FND_GLOBAL.USER_ID,
X_last_update_login => FND_GLOBAL.CONC_LOGIN_ID,
X_seq_num => l_seq_num,
X_entity_name => p_Fnd_Attachment_rec.entity_name,
x_column1 => null,
X_pk1_value => p_Fnd_Attachment_rec.pk1_value,
X_pk2_value => p_Fnd_Attachment_rec.pk2_value,
X_pk3_value => p_Fnd_Attachment_rec.pk3_value,
X_pk4_value => p_Fnd_Attachment_rec.pk4_value,
X_pk5_value => p_Fnd_Attachment_rec.pk5_value,
X_automatically_added_flag => p_Fnd_Attachment_rec.automatically_added_flag,
X_datatype_id => null,
X_category_id => null,
X_security_type => null,
X_publish_flag => null,
X_usage_type => p_Fnd_Attachment_rec.usage_type,
X_language => null,
X_media_id => l_media_id,
X_doc_attribute_Category => null,
X_doc_attribute1 => null,
X_doc_attribute2 => null,
X_doc_attribute3 => null,
X_doc_attribute4 => null,
X_doc_attribute5 => null,
X_doc_attribute6 => null,
X_doc_attribute7 => null,
X_doc_attribute8 => null,
X_doc_attribute9 => null,
X_doc_attribute10 => null,
X_doc_attribute11 => null,
X_doc_attribute12 => null,
X_doc_attribute13 => null,
X_doc_attribute14 => null,
X_doc_attribute15 => null
);