The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE NAME: test_val_header_delete()
===========================================================================*/
PROCEDURE test_val_header_delete(X_po_header_id IN NUMBER) IS
X_allow_delete BOOLEAN;
po_quotes_sv.val_header_delete(X_po_header_id, X_allow_delete);
if (X_allow_delete) then
dbms_output.put_line('Allow Delete = TRUE');
dbms_output.put_line('Allow Delete = FALSE');
END test_val_header_delete;
PROCEDURE NAME: val_header_delete()
===========================================================================*/
PROCEDURE val_header_delete(X_po_header_id IN NUMBER,
X_allow_delete IN OUT NOCOPY BOOLEAN) IS
x_progress VARCHAR2(3) := '';
x_delete_test VARCHAR2(1) := 'Y';
** If it is, display message and prevent delete.
*/
SELECT MAX('N')
INTO X_delete_test
FROM po_lines pol
WHERE pol.from_header_id = X_po_header_id;
IF (nvl(X_delete_test,'Y') = 'Y') THEN
/*
** Verify the Quotation is not used in autosource rules.
** If it is NOT, verify it is not on a req line.
** If it is, display message and prevent delete.
**
** CMOK: If ASL installed, use po_asl_documents table.
*/
SELECT MAX('N')
INTO X_delete_test
FROM po_asl_documents pad
WHERE pad.document_header_id = X_po_header_id;
IF (nvl(X_delete_test,'Y') = 'Y') THEN
/*
** Verify the Quotation is not referenced on a Requisition line.
** If it is NOT, allow the delete.
** If it is, display message and prevent delete.
*/
SELECT MAX('N')
INTO X_delete_test
FROM po_requisition_lines prl
WHERE prl.blanket_po_header_id = X_po_header_id;
IF (nvl(X_delete_test,'Y') = 'Y') THEN
X_allow_delete := TRUE;
dbms_output.put_line('Delete permitted');
X_allow_delete := FALSE;
po_message_s.app_error('PO_DELETE_QT_ON_REQ');
X_allow_delete := FALSE;
po_message_s.app_error('PO_QT_DELETE_SOURCE');
X_allow_delete := FALSE;
po_message_s.app_error('PO_DELETE_QT_ON_PO_NA');
po_message_s.sql_error('val_header_delete', x_progress, sqlcode);
END val_header_delete;
PROCEDURE NAME: test_val_line_delete()
===========================================================================*/
PROCEDURE test_val_line_delete(X_po_line_id IN NUMBER,
X_po_line_num IN NUMBER,
X_po_header_id IN NUMBER) IS
X_allow_delete VARCHAR2(1) := '';
po_quotes_sv.val_line_delete(X_po_line_id, X_po_line_num, X_po_header_id,
X_allow_delete);
dbms_output.put_line('Allow Delete = '||X_allow_delete);
END test_val_line_delete;
PROCEDURE NAME: val_line_delete()
===========================================================================*/
PROCEDURE val_line_delete(X_po_line_id IN NUMBER,
X_po_line_num IN NUMBER,
X_po_header_id IN NUMBER,
X_allow_delete IN OUT NOCOPY VARCHAR2) IS
x_progress VARCHAR2(3) := '';
SELECT pol.po_line_id
FROM po_lines pol
WHERE pol.from_header_id = X_po_header_id
AND pol.from_line_id = X_po_line_id;
SELECT prl.blanket_po_line_num
FROM po_requisition_lines prl
WHERE prl.BLANKET_PO_HEADER_ID = X_po_header_id
AND prl.BLANKET_PO_LINE_NUM = X_po_line_num;
** if it is, display message and prevent delete.
*/
IF C_ON_PO%NOTFOUND THEN
/*
** check to see if the Quotation line is used in ASL.
** if it is NOT, verify it is not on a req line.
** if it is, display message and prevent delete.
**
*/
x_progress := '040';
SELECT count(*)
INTO x_sourced
FROM po_asl_documents pad
WHERE pad.DOCUMENT_HEADER_ID = X_po_header_id
AND pad.DOCUMENT_LINE_ID = X_po_line_id;
** if it is NOT, allow the delete.
** if it is, display message and prevent delete.
*/
IF C_ON_REQ%NOTFOUND THEN
X_allow_delete := 'Y';
dbms_output.put_line('Allow delete = '||X_allow_delete);
X_allow_delete := 'N';
po_message_s.app_error('PO_DELETE_REQS');
dbms_output.put_line('Allow delete = '||X_allow_delete);
X_allow_delete := 'N';
po_message_s.app_error('PO_QT_LINE_DELETE_SOURCE');
dbms_output.put_line('Allow delete = '||X_allow_delete);
X_allow_delete := 'N';
po_message_s.app_error('PO_QT_LINE_DELETE_NA');
dbms_output.put_line('Allow delete = '||X_allow_delete);
po_message_s.sql_error('val_line_delete', x_progress, sqlcode);
END val_line_delete;
SELECT MAX('Y')
INTO x_duplicate_reply
FROM po_headers
WHERE from_header_id = X_from_header_id
AND vendor_id = X_vendor_id
AND vendor_site_id = X_vendor_site_id
AND from_type_lookup_code = 'RFQ';
SELECT MAX('Y')
INTO X_quote_referenced
FROM po_lines pol
WHERE pol.from_header_id = X_po_header_id;
SELECT MAX('Y')
INTO X_quote_referenced
FROM po_autosource_documents pad
WHERE pad.DOCUMENT_HEADER_ID = X_po_header_id;
** Get the defaults for the selected From RFQ number
*/
SELECT poh.rfq_close_date,
poh.type_lookup_code,
poh.approval_required_flag
INTO X_rfq_close_date,
X_from_type_lookup_code,
X_approval_required_flag
FROM po_headers poh
WHERE poh.po_header_id = X_from_header_id;
SELECT MAX('Y')
INTO X_approval_status
FROM po_quotation_approvals
WHERE line_location_id = X_line_location_id
AND sysdate BETWEEN nvl(start_date_active, sysdate-1)
AND nvl(end_date_active, sysdate+1);