The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT version_number
INTO l_latest_version_number
FROM oe_blanket_headers_all
WHERE header_id = p_copy_from_doc_id;
SELECT version_number
INTO l_latest_version_number
FROM oe_order_headers_all
WHERE header_id = p_copy_from_doc_id;
SELECT 'x'
FROM fnd_attached_documents
WHERE
(
entity_name = 'OKC_CONTRACT_DOCS'
AND pk1_value = p_doc_type
AND pk2_value = to_char(p_doc_id)
-------AND pk3_value = l_doc_version_number
AND pk3_value = G_CURRENT_VERSION_NUMBER /* Note: the contract document attachment creation java API always creates the current
version of the attachment as -99 during the workflow approval process.
(the contract document attachment creation java API increments the version number
from 0,1... later after the attachment has been archived once) */
)
OR
(
entity_name = 'OE_ORDER_HEADERS'
AND pk1_value = to_char(p_doc_id)
);
SELECT version_number
FROM oe_blanket_headers_all
WHERE header_id = cp_header_id;
SELECT version_number
FROM oe_order_headers_all
WHERE header_id = cp_header_id;
PROCEDURE delete_articles
(
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
p_commit IN VARCHAR2 := FND_API.G_FALSE,
p_doc_type IN VARCHAR2,
p_doc_id IN NUMBER,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2
) IS
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
oe_debug_pub.add('In OE_Contracts_util.delete_articles ', 1);
oe_debug_pub.add('Contractual option not licensed, hence exiting delete_articles ', 3);
oe_debug_pub.add('Calling OKC_TERMS_UTIL_GRP.delete_doc ', 3);
OKC_TERMS_UTIL_GRP.delete_doc (
p_api_version => p_api_version,
p_init_msg_list => p_init_msg_list,
p_commit => p_commit,
p_doc_type => p_doc_type,
p_doc_id => p_doc_id,
x_return_status => x_return_status,
x_msg_data => x_msg_data,
x_msg_count => x_msg_count
);
oe_debug_pub.add('End of OE_Contracts_util.delete_articles, x_return_status ' || x_return_status, 1);
oe_debug_pub.add('WHEN G_EXC_ERROR in delete_articles ', 3);
oe_debug_pub.add('WHEN G_EXC_UNEXPECTED_ERROR in delete_articles ', 3);
oe_debug_pub.add('WHEN OTHERS in delete_articles ', 3);
'delete_articles'
);
END delete_articles;
/** note: in cursors based on table OE_BLANKET_HEADERS_ALL, we select on the basis
of HEADER_ID only as it is unique and an index is based on that, we don't need SALES_DOCUMENT_TYPE_CODE **/
--cursor to fetch value of header level variables such as OKC$S_BLANKET_NUMBER etc. for blankets
CURSOR c_get_bsa_header_variables IS
SELECT bh.order_number,
bh.agreement_id,
bh.sold_to_org_id,
bh.order_type_id,
bh.cust_po_number,
bh.version_number,
bh.sold_to_contact_id,
bh.salesrep_id,
bh.transactional_curr_code,
bhe.start_date_active,
bhe.end_date_active,
bh.freight_terms_code,
bh.shipping_method_code,
bh.payment_term_id,
bh.invoicing_rule_id,
bhe.blanket_min_amount,
bhe.blanket_max_amount,
bh.org_id
FROM oe_blanket_headers_all bh,
oe_blanket_headers_ext bhe
WHERE bh.header_id = p_doc_id
AND bh.order_number = bhe.order_number;
SELECT oh.order_number,
oh.blanket_number,
oh.agreement_id,
oh.quote_number,
oh.sold_to_org_id,
oh.cust_po_number,
oh.version_number,
oh.sold_to_contact_id,
oh.salesrep_id,
oh.transactional_curr_code,
oh.freight_terms_code,
oh.shipping_method_code,
oh.payment_term_id,
oh.invoicing_rule_id,
oh.org_id
FROM oe_order_headers_all oh
WHERE oh.header_id = p_doc_id;
SELECT item_identifier_type, --eg. INT
ordered_item, --eg. AS54888
ordered_item_id,
org_id,
inventory_item_id,
sold_to_org_id
FROM oe_blanket_lines_all
WHERE header_id = p_doc_id
AND p_doc_type = OE_CONTRACTS_UTIL.G_BSA_DOC_TYPE
AND item_identifier_type <> 'CAT'
UNION ALL
--cursor to get all the items of the Sales Order i.e. internal (INT) customer (CUST) etc.
--returns non-translatable code eg. AS54888
SELECT item_identifier_type, --eg. INT
ordered_item, --eg. AS54888
ordered_item_id,
org_id,
inventory_item_id,
sold_to_org_id
FROM oe_order_lines_all
WHERE header_id = p_doc_id
AND p_doc_type = OE_CONTRACTS_UTIL.G_SO_DOC_TYPE
AND item_identifier_type <> 'CAT'
ORDER BY ordered_item;
SELECT ordered_item
FROM oe_blanket_lines_all
WHERE header_id = p_doc_id
AND p_doc_type = OE_CONTRACTS_UTIL.G_BSA_DOC_TYPE
AND item_identifier_type = 'CAT'
UNION ALL
--cursor to retrieve the item categories (CATs) in the Sales Order
--returns non-translatable code eg. 208.05
SELECT ordered_item
FROM oe_order_lines_all
WHERE header_id = p_doc_id
AND p_doc_type = OE_CONTRACTS_UTIL.G_SO_DOC_TYPE
AND item_identifier_type = 'CAT'
ORDER BY ordered_item;
SELECT category_concat_segs
FROM mtl_item_categories_v
WHERE inventory_item_id = cp_inventory_item_id
AND organization_id = cp_org_id -- should be inventory master org
AND structure_id = 101; -- hardcoded to 101 i.e. Item Categories (Inv. Items) for Order Management
SELECT a.customer_signature,
a.customer_signature_date
FROM oe_order_headers_all a
WHERE a.header_id = p_doc_id;
SELECT order_number
INTO l_document_number
FROM oe_order_headers_all
WHERE header_id = p_target_doc_id;
SELECT org_id into l_org_id
FROM oe_order_headers_all
WHERE header_id=p_doc_id;