Custom Search

Wednesday, 9 October 2013

Useful Scripts

1. Diabling all the users:

DECLARE

CURSOR c_user is
SELECT user_name
  FROM fnd_user
 WHERE TRUNC(NVL(end_date,SYSDATE)) >= TRUNC(sysdate);

type t_user_name is table of fnd_user.user_name%TYPE;
lt_user_name t_user_name;

begin

open c_user;
fetch c_user bulk collect into lt_user_name;
close c_user;

for i in 1..lt_user_name.COUNT LOOP
  fnd_user_pkg.updateuser(x_user_name => lt_user_name(i)
                         ,x_owner     => null
                         ,x_end_date  => TRUNC(sysdate-1) );
                        
  dbms_output.put_line('User Disabled:'||lt_user_name(i));
END LOOP;

COMMIT;

dbms_output.put_line('commit Complete');

EXCEPTION

WHEN OTHERS THEN
dbms_output.put_line('Exception');

END;



Print This Post
 

No comments:

Post a Comment