The following lines contain the word 'select', 'insert', 'update' or 'delete':
l_original_update_to_cnt VARCHAR2(2);
select wddc.lpn_id,
wddp.lpn_id old_parent_lpn_id
from wsh_delivery_details wddc,
wsh_delivery_details wddp,
wsh_delivery_assignments_v wda,
wsh_wms_sync_tmp wlst
where wlst.delivery_detail_id = wda.delivery_detail_id
and wddc.delivery_detail_id = wda.delivery_detail_id
and wlst.parent_delivery_detail_id = wddp.delivery_detail_id
and nvl(wda.parent_delivery_detail_id, -1) <> nvl(wlst.parent_delivery_detail_id,-1)
and wlst.parent_delivery_detail_id is not null
and wlst.operation_type = 'PRIOR'
and wddc.lpn_id is not null
and wddp.lpn_id is not null
and wlst.creation_date = p_hw_time_stamp
order by
wlst.parent_delivery_detail_id;
select wddc.lpn_id,
wddp.lpn_id parent_lpn_id
from wsh_delivery_details wddc,
wsh_delivery_details wddp,
wsh_delivery_assignments_v wda,
wsh_wms_sync_tmp wlst
where wlst.delivery_detail_id = wda.delivery_detail_id
and wddc.delivery_detail_id = wda.delivery_detail_id
and wda.parent_delivery_detail_id = wddp.delivery_detail_id
and nvl(wda.parent_delivery_detail_id, -1) <> nvl(wlst.parent_delivery_detail_id,-1)
and wda.parent_delivery_detail_id is not null
and wddc.lpn_id is not null
and wddp.lpn_id is not null
and wlst.operation_type = 'PRIOR'
and wlst.creation_date = p_hw_time_stamp
order by
wda.parent_delivery_detail_id;
select wdd.lpn_id,
wlst.delivery_id old_delivery_id
from wsh_delivery_details wdd,
wsh_delivery_assignments_v wda,
wsh_wms_sync_tmp wlst
where wlst.delivery_detail_id = wda.delivery_detail_id
and wdd.delivery_detail_id = wda.delivery_detail_id
and nvl(wda.delivery_id, -1) <> nvl(wlst.delivery_id,-1)
and wlst.delivery_id is not null
and wdd.lpn_id is not null
and wlst.operation_type = 'PRIOR'
and wlst.creation_date = p_hw_time_stamp
order by
wlst.delivery_id;
select wdd.lpn_id,
wda.delivery_id new_delivery_id
from wsh_delivery_details wdd,
wsh_delivery_assignments_v wda,
wsh_wms_sync_tmp wlst
where wlst.delivery_detail_id = wda.delivery_detail_id
and wdd.delivery_detail_id = wda.delivery_detail_id
and nvl(wda.delivery_id, -1) <> nvl(wlst.delivery_id,-1)
and wda.delivery_id is not null
and wdd.lpn_id is not null
and wlst.operation_type = 'PRIOR'
and wlst.creation_date = p_hw_time_stamp
order by
wda.delivery_id;
cursor l_update_csr (p_hw_time_stamp IN DATE) is
select wdd.lpn_id,
wlst.delivery_detail_id,
wdd.container_name,
wdd.inventory_item_id,
wdd.organization_id,
wdd.subinventory,
wdd.locator_id,
wdd.gross_weight,
wdd.volume_uom_code,
wdd.filled_volume,
wdd.volume,
wdd.weight_uom_code,
wdd.net_weight
from wsh_delivery_details wdd,
wsh_wms_sync_tmp wlst
where wlst.delivery_detail_id = wdd.delivery_detail_id
and wdd.lpn_id is not null
and wlst.operation_type = 'UPDATE'
and wlst.creation_date = p_hw_time_stamp;
select count(*) into l_tmp_tbl_size from wsh_wms_sync_tmp
where creation_date = l_current_hw_time_stamp;
update wsh_wms_sync_tmp
set operation_type = 'DELETE'
where delivery_detail_id in (select delivery_detail_id
from wsh_wms_sync_tmp
where operation_type = 'DELETE'
and creation_date = l_current_hw_time_stamp)
and operation_type = 'UPDATE'
and creation_date = l_current_hw_time_stamp;
WSH_DEBUG_SV.log(l_module_name,'Count of rows updated is', SQL%ROWCOUNT);
l_unpack_lpn_id_tbl.delete;
l_pack_lpn_id_tbl.delete;
l_unasgn_lpn_id_tbl.delete;
l_asgn_lpn_id_tbl.delete;
FOR update_rec in l_update_csr(l_current_hw_time_stamp) LOOP
--{
IF l_debug_on THEN
WSH_DEBUG_SV.log(l_module_name,'Inside the loop i is', i);
WSH_DEBUG_SV.log(l_module_name,'Inside the loop delivery_detail_id is', update_rec.delivery_detail_id);
WSH_DEBUG_SV.log(l_module_name,'Inside the loop lpn_id is', update_rec.lpn_id);
IF (update_rec.lpn_id IS NOT NULL) THEN
l_wms_lpn_tbl(i).LPN_ID := update_rec.lpn_id;
l_wms_lpn_tbl(i).LICENSE_PLATE_NUMBER := update_rec.container_name;
l_wms_lpn_tbl(i).INVENTORY_ITEM_ID := update_rec.inventory_item_id;
l_wms_lpn_tbl(i).ORGANIZATION_ID := update_rec.ORGANIZATION_ID;
l_wms_lpn_tbl(i).SUBINVENTORY_CODE := update_rec.SUBINVENTORY;
l_wms_lpn_tbl(i).LOCATOR_ID := update_rec.LOCATOR_ID;
l_wms_lpn_tbl(i).GROSS_WEIGHT_UOM_CODE := update_rec.weight_uom_code;
l_wms_lpn_tbl(i).GROSS_WEIGHT := update_rec.gross_weight;
l_wms_lpn_tbl(i).CONTAINER_VOLUME_UOM := update_rec.volume_uom_code;
l_wms_lpn_tbl(i).CONTAINER_VOLUME := update_rec.volume;
l_wms_lpn_tbl(i).CONTENT_VOLUME_UOM_CODE := update_rec.volume_uom_code;
l_wms_lpn_tbl(i).CONTENT_VOLUME := update_rec.filled_volume;
l_wms_lpn_tbl(i).TARE_WEIGHT_UOM_CODE := update_rec.weight_uom_code;
l_wms_lpn_tbl(i).TARE_WEIGHT := (update_rec.gross_weight - update_rec.net_weight);
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';
cursor l_pr_update_csr (p_hw_time_stamp IN DATE) is
select wdd.lpn_id,
wlst.delivery_detail_id,
wdd.container_name,
wdd.inventory_item_id,
wdd.organization_id,
wdd.subinventory,
wdd.locator_id,
wdd.gross_weight,
wdd.volume_uom_code,
wdd.filled_volume,
wdd.volume,
wdd.weight_uom_code,
wdd.net_weight,
wlst.call_level
from wsh_delivery_details wdd,
wsh_wms_sync_tmp wlst
where wlst.delivery_detail_id = wdd.delivery_detail_id
and wdd.lpn_id is not null
and wlst.operation_type = 'UPDATE'
and wlst.creation_date = p_hw_time_stamp
order by nvl(wlst.call_level,0) desc;
FOR update_rec in l_pr_update_csr(l_current_hw_time_stamp) LOOP
--{
--
IF l_debug_on THEN
WSH_DEBUG_SV.log(l_module_name,'count of plsql table l_wms_lpn_tbl is', l_wms_lpn_tbl.count);
l_call_level := nvl(update_rec.call_level,0);
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';
l_wms_lpn_tbl.delete;
WSH_DEBUG_SV.log(l_module_name,'Inside the loop delivery_detail_id is', update_rec.delivery_detail_id);
WSH_DEBUG_SV.log(l_module_name,'Inside the loop lpn_id is', update_rec.lpn_id);
l_wms_lpn_tbl(i).LPN_ID := update_rec.lpn_id;
l_wms_lpn_tbl(i).LICENSE_PLATE_NUMBER := update_rec.container_name;
l_wms_lpn_tbl(i).INVENTORY_ITEM_ID := update_rec.inventory_item_id;
l_wms_lpn_tbl(i).ORGANIZATION_ID := update_rec.ORGANIZATION_ID;
l_wms_lpn_tbl(i).SUBINVENTORY_CODE := update_rec.SUBINVENTORY;
l_wms_lpn_tbl(i).LOCATOR_ID := update_rec.LOCATOR_ID;
l_wms_lpn_tbl(i).GROSS_WEIGHT_UOM_CODE := update_rec.weight_uom_code;
l_wms_lpn_tbl(i).GROSS_WEIGHT := update_rec.gross_weight;
l_wms_lpn_tbl(i).CONTAINER_VOLUME_UOM := update_rec.volume_uom_code;
l_wms_lpn_tbl(i).CONTAINER_VOLUME := update_rec.volume;
l_wms_lpn_tbl(i).CONTENT_VOLUME_UOM_CODE := update_rec.volume_uom_code;
l_wms_lpn_tbl(i).CONTENT_VOLUME := update_rec.filled_volume;
l_wms_lpn_tbl(i).TARE_WEIGHT_UOM_CODE := update_rec.weight_uom_code;
l_wms_lpn_tbl(i).TARE_WEIGHT := (update_rec.gross_weight - update_rec.net_weight);
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';
IF (nvl(wsh_wms_lpn_grp.g_update_to_containers,'N') = 'Y') THEN
wsh_wms_lpn_grp.g_update_to_containers := 'N';