Oracle Apps修改用户密码的API

Oracle Apps修改用户密码的API

方法一:fnd_user_pkg.updateuser (推荐方式)
-- Change password of TEST_USER to oracle123 (does not ask for reset on first logon)
BEGIN
   fnd_user_pkg.updateuser (x_user_name                   => 'TEST_USER',
x_owner => 'CUST',
x_unencrypted_password => 'oracle123',
                            x_end_date                    => fnd_user_pkg.null_date,
x_password_date => SYSDATE - 10,
                            x_password_accesses_left      => 10000,
                            x_password_lifespan_accesses  => 10000,
                            x_password_lifespan_days      => 10000
                           );
   COMMIT;
END;

UpdateUser API Specification
-- UpdateUser (Public)
--   Update any column for a particular user record. If that user does
--   not exist, exception raised with error message.
--   You can use this procedure to update a user's password for example.
--
--   *** NOTE: This version accepts the old customer_id/employee_id
--   keys foreign keys to the "person".  Use UpdateUserParty to update
--   a user with the new person_party_id key.
--
-- Usage Example in pl/sql
--   begin fnd_user_pkg.updateuser('SCOTT', 'SEED', 'DRAGON'); end;
--
-- Mandatory Input Arguments
--   x_user_name: An existing user name
--   x_owner:     'SEED' or 'CUST'(customer)
--
procedure UpdateUser (
  x_user_name                  in varchar2,
  x_owner                      in varchar2,
  x_unencrypted_password       in varchar2 default null,
  x_session_number             in number default null,
  x_start_date                 in date default null,
  x_end_date                   in date default null,
  x_last_logon_date            in date default null,
  x_description                in varchar2 default null,
  x_password_date              in date default null,
  x_password_accesses_left     in number default null,
  x_password_lifespan_accesses in number default null,
  x_password_lifespan_days     in number default null,
  x_employee_id                in number default null,
  x_email_address              in varchar2 default null,
  x_fax                        in varchar2 default null,
  x_customer_id                in number default null,
  x_supplier_id                in number default null,
  x_old_password               in varchar2 default null)
is
begin
  UpdateUserInternal(
    x_user_name => x_user_name,
    x_owner => x_owner,
    x_unencrypted_password => x_unencrypted_password,
    x_session_number => x_session_number,
    x_start_date => x_start_date,
    x_end_date => x_end_date,
    x_last_logon_date => x_last_logon_date,
    x_description => x_description,
    x_password_date => x_password_date,
    x_password_accesses_left => x_password_accesses_left,
    x_password_lifespan_accesses => x_password_lifespan_accesses,
    x_password_lifespan_days => x_password_lifespan_days,
    x_employee_id => x_employee_id,
    x_email_address => x_email_address,
    x_fax => x_fax,
    x_customer_id => x_customer_id,
    x_supplier_id => x_supplier_id,
    x_person_party_id => null,
    x_old_password => x_old_password,
    x_mode => 'EMPLOYEE');
end UpdateUser;


方法二:fnd_web_sec.change_password (不推荐)
-- Change TEST_USER Password from PL/SQL
SET serveroutput on

DECLARE
   return_value   VARCHAR2 (200);
BEGIN
return_value := fnd_web_sec.change_password ('TEST_USER', 'oracle123');
   DBMS_OUTPUT.put_line ('Result ' || return_value);   -- Y Means Success Else Fail.
   COMMIT;
END;

第二种方式主要为内部使用,不推荐外部调用。
-- This routine is for AOL INTERNAL USE ONLY !!!!!!!
-- Please call the fnd_user_pkg.changepassword wrapper to protect
-- against undocumented underlying FND changes.
--
-- Changes the password of an applications user after verifying
-- the existing pasword.  Returns 'Y' on success and 'N' on failure.

-- Fix bug 5087728. Added fifth argument to specify whether autonomous
-- transaction is needed during set_password. Default is TRUE to maintain
-- backward compatibility
FUNCTION change_password(p_user IN VARCHAR2,
                         p_old_pwd IN VARCHAR2,
                         p_new_pwd1 IN VARCHAR2,
                         p_new_pwd2 IN VARCHAR2,
                         p_autonomous IN BOOLEAN DEFAULT TRUE)
  RETURN VARCHAR2;





你可能感兴趣的:(Oracle Apps修改用户密码的API)