The following lines contain the word 'select', 'insert', 'update' or 'delete':
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,x_progress);
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,'L_DOCUMENT_TYPE ::' || l_document_type);
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,'L_DOCUMENT_SUBTYPE::' || l_document_subtype);
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,'L_DOCUMENT_ID::' || l_document_id);
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,'L_REVISION_NUM::' || l_revision_num);
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,'L_FPDSNG_FLAG::' || l_fpdsng_flag);
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,x_progress);
SELECT pr.po_header_id, pr.release_num INTO l_document_id, l_release_num
FROM po_releases_all pr
WHERE pr.po_release_id = l_document_id;
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,x_progress);
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
SELECT TYPE_LOOKUP_CODE into l_doc_type
FROM po_headers_all ph
WHERE po_header_id = p_document_id ;
SELECT revision_num INTO PO_COMM_FPDSNG_PVT.g_revision_num
FROM po_headers_all WHERE po_header_id = PO_COMM_FPDSNG_PVT.g_document_id;
SELECT po_release_id INTO PO_COMM_FPDSNG_PVT.g_release_id
FROM po_releases_all
WHERE po_header_id=p_document_id AND
release_num= p_release_num;
l_idvidQuery:=' SELECT decode(PO_COMM_FPDSNG_PVT.getReleaseId(), null,
PO_COMM_FPDSNG_PVT.getDocumentId(),PO_COMM_FPDSNG_PVT.getReleaseId()) PIID,
PO_COMM_FPDSNG_PVT.getRevisionNum modNumber
FROM dual';
l_refidvidQuery := 'SELECT PO_COMM_FPDSNG_PVT.getDocumentId() PIID,
PO_COMM_FPDSNG_PVT.getRevisionNum modNumber
from dual';
l_ContractDatesQuery :=' SELECT poh.start_date effectiveDate,
poh.end_date lastDateToOrder
FROM po_headers_all poh
WHERE
poh.po_header_id= PO_COMM_FPDSNG_PVT.getDocumentId()';
l_dollarValueQuery:='SELECT sum(NVL(encumbered_amount,0)) obligatedAmount,
po_core_s.get_total(''R'', PO_COMM_FPDSNG_PVT.getReleaseId()) baseAndExcercisedOptionsValue
from po_distributions_all pod,
po_releases_all por where por.po_release_id=pod.po_release_id
and por.po_release_id =PO_COMM_FPDSNG_PVT.getReleaseId()';
l_dollarValueQuery := ' SELECT sum(NVL(encumbered_amount,0)) obligatedAmount,
po_core_s.get_total(''H'', PO_COMM_FPDSNG_PVT.getDocumentId()) baseAndExcercisedOptionsValue
from po_distributions_all pod,
po_headers_all poh where poh.po_header_id=pod.po_header_id
and poh.po_header_id =PO_COMM_FPDSNG_PVT.getDocumentId()';
l_contractMarketingQuery := 'SELECT pov.email_address emailAddress
FROM po_vendor_sites_all pov, po_headers_all poh
WHERE pov.vendor_site_id= poh.vendor_site_id
AND poh.po_header_id=PO_COMM_FPDSNG_PVT.getDocumentId()';
l_contractDataQuery := 'SELECT
decode(PO_COMM_FPDSNG_PVT.getReleaseId(),null,PO_COMM_FPDSNG_PVT.getDocumentId(),
PO_COMM_FPDSNG_PVT.getReleaseId()) solicitationID,
poh.comments descOfContractRequirement,
decode(PO_COMM_FPDSNG_PVT.getReleaseId(),NULL,
Decode(
Greatest((sysdate - poh.creation_date), 366),
366,''false'',''true''),
Decode(
Greatest((poh.end_date - poh.start_date), 366),
366,''false'',''true'')
) multiYearContract,
decode(PO_COMM_FPDSNG_PVT.getReleaseId(),NULL,poh.pcard_id,por.pcard_id) purchaseCardAsPaymentMethod
FROM po_headers_all poh, po_releases_all por
WHERE poh.po_header_id = por.po_header_id (+)
AND poh.po_header_id = PO_COMM_FPDSNG_PVT.getDocumentId()
AND por.po_release_id (+)= PO_COMM_FPDSNG_PVT.getReleaseId()' ;
l_ProductInfoQuery := 'SELECT mck.concatenated_segments productOrServiceCode,
fcv.naics_code1 principalNAICSCode
FROM fv_ccr_vendors fcv, mtl_categories_kfv mck,
po_vendor_sites_all pvs, po_headers_all poh,
po_lines_all pol, po_releases_all por
WHERE
poh.vendor_site_id = pvs.vendor_site_id
and pvs.duns_number = fcv.duns (+)
and mck.category_id = pol.category_id
and poh.po_header_id = pol.po_header_id
and por.po_release_id = PO_COMM_FPDSNG_PVT.getReleaseId()
and poh.po_header_id= PO_COMM_FPDSNG_PVT.getDocumentId()';
l_ProductInfoQuery := 'SELECT mck.concatenated_segments productOrServiceCode,
fcv.naics_code1 principalNAICSCode
FROM fv_ccr_vendors fcv, mtl_categories_kfv mck,
po_vendor_sites_all pvs, po_headers_all poh, po_lines_all pol
WHERE poh.vendor_site_id = pvs.vendor_site_id
and pvs.duns_number = fcv.duns (+)
and mck.category_id = pol.category_id
and poh.po_header_id = pol.po_header_id
and poh.po_header_id= PO_COMM_FPDSNG_PVT.getDocumentId()';
l_vendorHeaderQuery := 'SELECT vendor_name vendorName
FROM po_vendors pov, po_headers_all poh
WHERE pov.vendor_id= poh.vendor_id
AND poh.po_header_id= PO_COMM_FPDSNG_PVT.getDocumentId()';
l_vendorLocQuery := 'SELECT vendor_site_code VendorSiteCode ,
address_line1 streetAddress, address_line2 streetAddress2,
address_line3 streetAddress3, city, state, zip ZIPCode,
country countryCode, duns_number DUNSNumber,
(area_code) || phone phoneNo, (fax_area_code) || pov.fax faxNo
FROM po_vendor_sites_all pov, po_headers_all poh
WHERE pov.vendor_site_id = poh.vendor_site_id
AND poh.po_header_id=PO_COMM_FPDSNG_PVT.getDocumentId()';
SELECT ph.org_id into l_org_id
FROM po_headers_all ph
WHERE po_header_id = p_document_id;
SELECT userenv('LANG') INTO l_language FROM dual;
SELECT ph.segment1 into l_po_number
FROM po_headers_all ph
WHERE po_header_id = p_document_id;
SELECT release_num INTO l_release_num
FROM po_releases_all
WHERE po_release_id = PO_COMM_FPDSNG_PVT.getReleaseId();
SELECT DISTINCT fl.file_id INTO p_media_id
FROM fnd_lobs fl,fnd_attached_documents fad
WHERE
fad.pk1_value = TO_CHAR(p_document_id) and
fad.pk2_value = TO_CHAR(p_revision_number) and
fad.entity_name = l_entity_name AND
fl.file_name = p_file_name;
SELECT category_id into l_category_id
from fnd_document_categories
where name = 'CUSTOM2446' ;
FND_DOCUMENTS_PKG.Insert_Row(
l_Row_id_tmp,
l_document_id_tmp,
SYSDATE,
1, --NVL(X_created_by,0),
SYSDATE,
1, --NVL(X_created_by,0),
1, --X_last_update_login,
6,
l_category_id, --Get the value for the category id 'PO Documents'
1, --security_type,
null, --security_id,
'Y', --publish_flag,
null, --image_type,
null, --storage_type,
'O', --usage_type,
sysdate,--start_date_active,
null, --end_date_active,
null, --X_request_id,
null, --X_program_application_id,
null, --X_program_id,
SYSDATE,
null, --language,
null, --description,
p_file_name,
p_media_id);
INSERT INTO fnd_lobs (
file_id,
File_name,
file_content_type,
upload_date,
expiration_date,
program_name,
program_tag,
file_data,
language,
oracle_charset,
file_format)
VALUES
(p_media_id,
p_file_name,
l_file_content_type,
sysdate,
null,
null,
null,
p_result,
null,
null,
'binary');
INSERT INTO fnd_attached_documents (
attached_document_id,
document_id,
creation_date,
created_by,
last_update_date,
last_updated_by,
last_update_login,
seq_num,
entity_name,
pk1_value,
pk2_value,
pk3_value,
pk4_value,
pk5_value,
automatically_added_flag,
program_application_id,
program_id,
program_update_date,
request_id,
attribute_category,
attribute1,
attribute2,
attribute3,
attribute4,
attribute5,
attribute6,
attribute7,
attribute8,
attribute9,
attribute10,
attribute11,
attribute12,
attribute13,
attribute14,
attribute15,
column1)
VALUES
(fnd_attached_documents_s.nextval,
l_document_id_tmp,
sysdate,
1,--NVL(X_created_by,0),
sysdate,
1,--NVL(X_created_by,0),
null,-- X_last_update_login,
10,
l_entity_name,
to_char(p_document_id),
to_char(p_revision_number),
null, null, null,
'N',
null, null, sysdate,
null, null, null, null, null,
null, null, null, null, null,
null, null, null, null, null,
null, null, null);
PO_DEBUG.debug_var(g_log_head || l_api_name, l_progress, 'Data Inserted in Tables. After', l_progress);
UPDATE fnd_lobs SET file_data = p_result, upload_date = sysdate
WHERE file_id = p_media_id;
PO_DEBUG.debug_var(g_log_head || l_api_name, l_progress, 'Data Updated in Table. After', l_progress);
select pr.po_header_id, pr.release_num into l_header_id, l_release_num
from po_releases_all pr
where pr.po_release_id = p_document_id;