The following lines contain the word 'select', 'insert', 'update' or 'delete':
select resource_id, resource_type
from cac_cal_resources
where user_name = FND_GLOBAL.USER_NAME;
select user_name
from cac_cal_resources
where resource_id = b_resource_id
and resource_type = b_resource_type;
select instance_set_id from fnd_object_instance_sets
where instance_set_name = 'JTF_TASK_RESOURCE_TASKS';
PROCEDURE INSERT_GRANTS
( p_grantee IN VARCHAR2
, p_resource_id IN NUMBER
, p_resource_type IN VARCHAR2
, p_instance_set_id IN NUMBER
, p_start_date IN DATE
, p_end_date IN DATE
, p_appointment_access IN VARCHAR2
, p_task_access IN VARCHAR2
, p_booking_access IN VARCHAR2
) IS
l_grant_guid RAW(16);
END INSERT_GRANTS;
INSERT_GRANTS
( p_grantee => p_grantee_user_name
, p_resource_id => l_resource_id
, p_resource_type => l_resource_type
, p_instance_set_id => l_instance_set_id
, p_start_date => p_grantee_start_date
, p_end_date => p_grantee_end_date
, p_appointment_access => p_appointment_access
, p_task_access => p_task_access
, p_booking_access => p_booking_access
);
PROCEDURE UPDATE_GRANTS
( p_grantee_user_name IN VARCHAR2
, p_grantee_start_date IN DATE
, p_grantee_end_date IN DATE
, p_appointment_access IN VARCHAR2
, p_task_access IN VARCHAR2
, p_booking_access IN VARCHAR2
, x_return_status OUT NOCOPY VARCHAR2
, x_msg_count OUT NOCOPY NUMBER
, x_msg_data OUT NOCOPY VARCHAR2
) IS
CURSOR C_GET_GRANTS
(
b_grantee VARCHAR2,
b_resource_id NUMBER,
b_resource_type VARCHAR2,
b_instance_set_id NUMBER
) IS
SELECT fgs.grant_guid
FROM FND_GRANTS fgs
, FND_MENUS fmu
, FND_OBJECTS fos
WHERE fgs.object_id = fos.object_id
AND fos.obj_name = 'CAC_CAL_RESOURCES'
AND fgs.menu_id = fmu.menu_id
AND fmu.menu_name IN ( 'JTF_CAL_READ_ACCESS'
, 'JTF_CAL_FULL_ACCESS'
, 'JTF_TASK_READ_ONLY'
, 'JTF_TASK_FULL_ACCESS'
, 'CAC_BKG_READ_ONLY_ACCESS'
)
AND fgs.grantee_type = 'USER'
AND fgs.grantee_key = b_grantee
AND fgs.instance_type = 'INSTANCE'
AND fgs.instance_pk1_value = TO_CHAR(b_resource_id)
AND fgs.instance_pk2_value = b_resource_type
AND fgs.program_tag = 'CAC_CAL_ACCESS'
UNION ALL
SELECT fgs.grant_guid
FROM FND_GRANTS fgs
, FND_MENUS fmu
, FND_OBJECTS fos
WHERE fgs.object_id = fos.object_id
AND fos.obj_name = 'JTF_TASKS'
AND fgs.menu_id = fmu.menu_id
AND fmu.menu_name IN ( 'JTF_TASK_READ_ONLY'
, 'JTF_TASK_FULL_ACCESS'
)
AND fgs.grantee_type = 'USER'
AND fgs.grantee_key = b_grantee
AND fgs.instance_type = 'SET'
AND fgs.instance_set_id = b_instance_set_id
AND fgs.parameter1 = TO_CHAR(b_resource_id)
AND fgs.PROGRAM_TAG = 'CAC_CAL_ACCESS' ;
l_api_name CONSTANT VARCHAR2(30) := 'update_grants';
INSERT_GRANTS
( p_grantee => p_grantee_user_name
, p_resource_id => l_resource_id
, p_resource_type => l_resource_type
, p_instance_set_id => l_instance_set_id
, p_start_date => p_grantee_start_date
, p_end_date => p_grantee_end_date
, p_appointment_access => p_appointment_access
, p_task_access => p_task_access
, p_booking_access => p_booking_access
);
END UPDATE_GRANTS;