DECLARE
CURSOR resp
IS
select fu.user_id,fr.application_id,fr.responsibility_id from
custom_user_responsibility aur,fnd_user fu,fnd_responsibility_VL fr
where aur.user_name = fu.user_name
and aur.responsibility_NAME = fr.responsibility_NAME
and fu.user_id||fr.responsibility_id not in (select user_id||responsibility_id from FND_USER_RESP_GROUPS_DIRECT);
v_user_id NUMBER;
v_resp_name varchar2(300);
v_resp_id number;
BEGIN
FOR resp_rec IN resp
LOOP
v_user_id := resp_rec.user_id;
-- v_resp_name := resp_rec.RESPONSIBILITY_name;
fnd_user_resp_groups_api.insert_assignment
(user_id => v_user_id,
responsibility_id => resp_rec.responsibility_id,
responsibility_application_id => resp_rec.application_id,
security_group_id => 0,
start_date => SYSDATE - 1,
end_date => NULL,
description => NULL
);
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE (v_resp_name);
END;
/
Provide the table script for the table custom_user_responsibility.
ReplyDelete