The following lines contain the word 'select', 'insert', 'update' or 'delete':
update_history EXCEPTION;
SELECT trading_partner_site_id
INTO l_Party_Site_ID
FROM mtl_client_parameters
WHERE client_id IN (SELECT cust_account_id
FROM hz_cust_accounts
WHERE party_id = P_txn_hist_record.trading_partner_id);
INV_TRANSACTIONS_HISTORY_PKG.Create_Update_Txns_History ( l_txn_hist_record,
l_xml_document_id,
l_txns_id,
l_return_status );
RAISE update_history;
WHEN update_history THEN
x_return_status := rcv_error_pkg.g_ret_sts_error;
inv_trx_util_pub.TRACE('update_history exception has occured.', 'INV_ONHAND_BALANCE', 9);
SELECT po_wf_itemkey_s.NEXTVAL
INTO l_orig_Event_Key
FROM DUAL;
SELECT party_id
INTO l_party_id
FROM hz_cust_accounts
WHERE cust_account_id IN (SELECT client_id
FROM mtl_client_parameters
WHERE client_code = P_client_code);
select location_id
into l_party_id
from hr_organization_units_v
where organization_id = P_Org_ID
and rownum = 1;
/* Raise event will insert the record into the transaction history table
for the current transaction.
*/
Raise_Event ( l_curr_txn_hist_record,
l_xml_document_id,
l_Return_Status );
l_select_stmt VARCHAR2(2000);
l_insert_stmt VARCHAR2(2000);
delete from MTL_LSP_ONHAND_BALANCE_TMP;
inv_trx_util_pub.TRACE('Initialize, rows deleted : '||sql%rowcount, 'INV_ONHAND_BALANCE', 9);
inv_trx_util_pub.TRACE('Exception : '||sqlerrm||' occurred in delete_temp_table', 'INV_ONHAND_BALANCE', 9);
select mtl_txns_history_s.nextval
into l_entity_id
from dual;
l_insert_stmt :='insert into MTL_LSP_ONHAND_BALANCE_TMP(ITEM_ID, ITEM, ITEM_DESCRIPTION, PRIMARY_UOM, PRIMARY_QUANTITY, SECONDARY_UOM, SECONDARY_QUANTITY, CATEGORY, CONTAINERIZED_FLAG, ONHAND_STATUS, SNAPSHOT_DATE, XML_DOCUMENT_ID ';
l_select_stmt :='select item_id, item, ITEM_DESCRIPTION, PRIMARY_UOM, sum(PRIMARY_QUANTITY), SECONDARY_UOM, sum(SECONDARY_QUANTITY), CATEGORY, CONTAINERIZED_FLAG, ONHAND_STATUS, SNAPSHOT_DATE, '||l_xml_doc_id;
l_insert_stmt :=l_insert_stmt||',WAREHOUSE, WAREHOUSE_ID ';
l_select_stmt :=l_select_stmt||',WAREHOUSE, WAREHOUSE_ID ';
l_insert_stmt :=l_insert_stmt||',WAREHOUSE, WAREHOUSE_ID,SUBINVENTORY ';
l_select_stmt :=l_select_stmt||',WAREHOUSE, WAREHOUSE_ID,SUBINVENTORY ';
l_insert_stmt :=l_insert_stmt||',WAREHOUSE, WAREHOUSE_ID,SUBINVENTORY,LOCATOR ';
l_select_stmt :=l_select_stmt||',WAREHOUSE, WAREHOUSE_ID,SUBINVENTORY,LOCATOR ';
l_insert_stmt :=l_insert_stmt||',LOT ';
l_select_stmt :=l_select_stmt||',LOT ';
l_where_stmt :=l_where_stmt||' and LOCATOR =(select concatenated_segments from mtl_item_locations_kfv where inventory_location_id='||p_locator||')';
l_stmt := l_insert_stmt||') '||l_select_stmt||' from mtl_onhand_sync_v '||l_where_stmt||l_group_by;
inv_trx_util_pub.TRACE('l_insert_stmt : '||l_insert_stmt, 'INV_ONHAND_BALANCE', 9);
inv_trx_util_pub.TRACE('l_select_stmt : '||l_select_stmt, 'INV_ONHAND_BALANCE', 9);
inv_trx_util_pub.TRACE('Rows inserted : '||sql%rowcount, 'INV_ONHAND_BALANCE', 9);