The following lines contain the word 'select', 'insert', 'update' or 'delete':
select validation_tmplt_id
into l_vtmplt_id
from oe_pc_vtmplts vt
where vt.validation_type = 'WF'
and vt.activity_name = 'UPG_AN_'||to_char(p_action_id)
and nvl(vt.activity_result_code,'NO_RESULT')
= decode(p_result_id,NULL,'NO_RESULT',
'UPG_RC_'||to_char(p_result_id));
updated BOOLEAN := FALSE;
SELECT vtmplt_id
INTO l_vtmplt_id
FROM oe_upgrade_pc_condns
WHERE condition_code = p_condition_code
AND old_object_id = p_old_object_id
AND NVL(action_id,FND_API.G_MISS_NUM) = NVL(p_action_id,FND_API.G_MISS_NUM)
AND NVL(result_id,FND_API.G_MISS_NUM) = NVL(p_result_id,FND_API.G_MISS_NUM)
AND rownum = 1;
updated := TRUE;
IF NOT updated THEN
UPDATE oe_upgrade_pc_condns
SET new_entity_id = p_entity_id
, validation_entity_id = nvl(p_condn_table(I).validation_entity_id
,p_entity_id)
, vtmplt_id = p_condn_table(I).validation_tmplt_id
, group_number = p_group_number
WHERE old_object_id = p_old_object_id
AND NVL(action_id,FND_API.G_MISS_NUM)
= NVL(p_action_id,FND_API.G_MISS_NUM)
AND NVL(result_id,FND_API.G_MISS_NUM)
= NVL(p_result_id,FND_API.G_MISS_NUM)
AND condition_code = p_condition_code;
updated := TRUE;
INSERT INTO oe_upgrade_pc_condns
(condition_code
,vtmplt_id
,OLD_OBJECT_ID
,ACTION_ID
,RESULT_ID
,NEW_ENTITY_ID
,GROUP_NUMBER
,VALIDATION_ENTITY_ID
,USER_MESSAGE
)
VALUES
(p_condition_code
,p_condn_table(I).validation_tmplt_id
,p_old_object_id
,p_action_id
,p_result_id
,p_entity_id
,p_group_number
,p_condn_table(I).validation_entity_id
,NULL);
PROCEDURE Upgrade_insert_condns IS
CURSOR old_condns IS
SELECT distinct OLD_OBJECT_ID, CONDITION_CODE, ACTION_ID, RESULT_ID
FROM oe_upgrade_pc_condns
ORDER BY OLD_OBJECT_ID, CONDITION_CODE, ACTION_ID, RESULT_ID;
update oe_upgrade_pc_condns
set vtmplt_id = null
, new_entity_id = null
, validation_entity_id = null
, group_number = null;
-- columns in R11 that need to be upgraded. This will delete
-- duplicate rows for the old conditions that may have been
-- created when this data was populated previously using
-- this script
delete from oe_upgrade_pc_condns
where rowid not in (
select min(rowid) from oe_upgrade_pc_condns
group by old_object_id, condition_code, action_id, result_id
) ;
END Upgrade_insert_condns;
PROCEDURE Upgrade_insert_scope IS
CURSOR old_scope IS
SELECT distinct SCOPE_CODE, old_object_id
FROM oe_upgrade_pc_scope
ORDER BY SCOPE_CODE;
UPDATE oe_upgrade_pc_scope
SET scope_op = l_scope_table(1).scope_op
, record_set_id = l_scope_table(1).record_set_id
, new_entity_id = l_scope_table(1).validation_entity_id
WHERE scope_code = s.scope_code
AND old_object_id = s.old_object_id;
END Upgrade_insert_scope;