Monday, May 4, 2009

PL/Sql Script to assign responsibilities to Oracle Users

DECLARE
l_user_id NUMBER;

CURSOR cur_rec
IS
SELECT *
FROM fnd_responsibility_vl
WHERE UPPER (responsibility_name) = UPPER ('XXXXX');
BEGIN
SELECT user_id
INTO l_user_id
FROM fnd_user
WHERE user_name = 'XXXX';

FOR rec_cur IN cur_rec
LOOP
fnd_user_resp_groups_api.insert_assignment
(user_id => l_user_id,
responsibility_id => rec_cur.responsibility_id,
responsibility_application_id => rec_cur.application_id,
security_group_id => 0,
start_date => SYSDATE - 1,
end_date => NULL,
description => NULL
);
COMMIT;
END LOOP;
END;

No comments: