The following lines contain the word 'select', 'insert', 'update' or 'delete':
x_batch_step_rec Updated batch step record
x_return_status Outcome of the API call
S - Success
E - Error
U - Unexpected error
=============================================================================*/
PROCEDURE unrelease_step (
p_batch_step_rec IN gme_batch_steps%ROWTYPE
,p_update_inventory_ind IN VARCHAR2
,p_create_resv_pend_lots IN NUMBER
,p_from_unrelease_batch IN NUMBER
,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
,x_return_status OUT NOCOPY VARCHAR2)
IS
CURSOR cur_get_step_materials (
v_batch_id gme_batch_header.batch_id%TYPE
,v_batchstep_id gme_batch_steps.batchstep_id%TYPE)
IS
SELECT d.*
FROM gme_batch_step_items i, gme_material_details d
WHERE d.batch_id = v_batch_id
AND d.material_detail_id = i.material_detail_id
AND i.batchstep_id = v_batchstep_id
AND d.release_type = gme_common_pvt.g_mtl_autobystep_release;
error_update_row EXCEPTION;
update_step_qty_error EXCEPTION;
IF NOT (gme_batch_steps_dbl.update_row (p_batch_step => x_batch_step_rec) ) THEN
RAISE error_update_row;
x_batch_step_rec.last_updated_by := gme_common_pvt.g_user_ident;
x_batch_step_rec.last_update_date := gme_common_pvt.g_timestamp;
x_batch_step_rec.last_update_login := gme_common_pvt.g_login_id;
,p_update_inventory_ind => p_update_inventory_ind
,p_create_resv_pend_lots => p_create_resv_pend_lots
,p_from_batch => FALSE
,x_return_status => x_return_status);
/* Invoke the update step qty API to update the step quantities and the */
/* quantities of the succeeding steps */
l_in_batch_step_rec := x_batch_step_rec;
gme_update_step_qty_pvt.update_step_qty
(p_batch_step_rec => l_in_batch_step_rec
,x_message_count => l_msg_count
,x_message_list => l_msg_stack
,x_return_status => x_return_status
,x_batch_step_rec => x_batch_step_rec);
RAISE update_step_qty_error;
UPDATE gme_batch_step_activities
SET actual_start_date = NULL
,plan_activity_factor = NVL (plan_activity_factor, 0)
,last_updated_by = gme_common_pvt.g_user_ident
,last_update_date = gme_common_pvt.g_timestamp
,last_update_login = gme_common_pvt.g_login_id
WHERE batchstep_id = x_batch_step_rec.batchstep_id
AND batch_id = x_batch_step_rec.batch_id;
UPDATE gme_batch_step_resources
SET actual_start_date = NULL
,plan_rsrc_count = NVL (plan_rsrc_count, 1)
,plan_rsrc_qty = NVL (plan_rsrc_qty, 0)
,plan_rsrc_usage = NVL (plan_rsrc_usage, 0)
,last_updated_by = gme_common_pvt.g_user_ident
,last_update_date = gme_common_pvt.g_timestamp
,last_update_login = gme_common_pvt.g_login_id
WHERE batchstep_id = x_batch_step_rec.batchstep_id
AND batch_id = x_batch_step_rec.batch_id;
UPDATE gme_batch_step_activities
SET plan_start_date = x_batch_step_rec.plan_start_date
WHERE batchstep_id = x_batch_step_rec.batchstep_id
AND batch_id = x_batch_step_rec.batch_id
AND plan_start_date IS NULL;
UPDATE gme_batch_step_resources
SET plan_start_date = x_batch_step_rec.plan_start_date
WHERE batchstep_id = x_batch_step_rec.batchstep_id
AND batch_id = x_batch_step_rec.batch_id
AND plan_start_date IS NULL;
UPDATE gme_batch_step_activities
SET plan_cmplt_date = x_batch_step_rec.plan_cmplt_date
WHERE batchstep_id = x_batch_step_rec.batchstep_id
AND batch_id = x_batch_step_rec.batch_id
AND plan_cmplt_date IS NULL;
UPDATE gme_batch_step_resources
SET plan_cmplt_date = x_batch_step_rec.plan_cmplt_date
WHERE batchstep_id = x_batch_step_rec.batchstep_id
AND batch_id = x_batch_step_rec.batch_id
AND plan_cmplt_date IS NULL;
WHEN error_update_row THEN
gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR'
,SQLERRM);
WHEN error_unrelease_matl OR update_step_qty_error THEN
NULL;
SELECT 1
FROM gme_batch_step_dependencies d, gme_batch_steps s
WHERE d.batchstep_id = s.batchstep_id AND
d.batch_id = s.batch_id AND
d.dep_step_id = v_batchstep_id AND
s.batch_id = v_batch_id AND
s.step_status <> gme_common_pvt.g_step_pending;