DECLARE
CURSOR c1
IS
select responsibility_id, application_id
from fnd_responsibility_vl a where
a.responsibility_name in
(
CURSOR c1
IS
select responsibility_id, application_id
from fnd_responsibility_vl a where
a.responsibility_name in
(
- and not exists (
select 1
from FND_USER_RESP_GROUPS_DIRECT
where user_id=
and responsibility_id=a.responsibility_id);
l_number NUMBER := 0;
BEGIN
FOR c1_rec IN c1
LOOP
BEGIN
SELECT 1
INTO l_number
FROM FND_USER_RESP_GROUPS_DIRECT a
WHERE a.responsibility_id = c1_rec.responsibility_id
AND a.user_id = 7081;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_number := 2;
WHEN OTHERS
THEN
l_number := 0;
END;
IF l_number = 2
THEN
DBMS_OUTPUT.
put_line (
'resp id --'
c1_rec.responsibility_id
'---Application id--> '
c1_rec.application_id);
fnd_user_resp_groups_api.
Insert_Assignment (
user_id => 7081,
responsibility_id => c1_rec.responsibility_id,
responsibility_application_id => c1_rec.application_id,
start_date => SYSDATE,
end_date => NULL,
description => NULL);
END IF;
END LOOP;
COMMIT;
END;