Sunday, 28 April 2013

TO RESET PASSWORD FOR THE USER IN ORACLE APPLICATIONS

/* Formatted on 2012/07/14 12:43 (Formatter Plus v4.8.8) */
DECLARE
   v_user_name      VARCHAR2 (30);
   v_new_password   VARCHAR2 (30) := 'welcome1';
   v_status         BOOLEAN;

   CURSOR c1
   IS
      SELECT user_name
        FROM fnd_user
       WHERE user_name BETWEEN 'PMGNU021' AND 'PMGNU099';
BEGIN
   FOR i IN c1
   LOOP
      DBMS_OUTPUT.put_line ('enrtry');
      v_user_name := i.user_name;
      v_status :=
         fnd_user_pkg.changepassword (username         => v_user_name,
                                      newpassword      => v_new_password
                                     );
      v_user_name := NULL;

      IF v_status = TRUE
      THEN
         DBMS_OUTPUT.put_line
                          (   'The password reset successfully for the User:'
                           || i.user_name
                          );
         COMMIT;
      ELSE
         DBMS_OUTPUT.put_line (   'Unable to reset password due to'
                               || SQLCODE
                               || ' '
                               || SUBSTR (SQLERRM, 1, 100)
                              );
         ROLLBACK;
      END IF;
   END LOOP;
END;

No comments:

Post a Comment