Oracle Apps修改用户密码的API 支持

本文介绍了如何使用Oracle Apps的API更新用户密码,包括fnd_user_pkg.updateuser和fnd_web_sec.change_password两个方法,详细阐述了参数及用法,并提供示例代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Oracle Apps修改用户密码的API

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

UpdateUser API Specification
  1. -- UpdateUser (Public)  
  2. --   Update any column for a particular user record. If that user does  
  3. --   not exist, exception raised with error message.  
  4. --   You can use this procedure to update a user's password for example.  
  5. --  
  6. --   *** NOTE: This version accepts the old customer_id/employee_id  
  7. --   keys foreign keys to the "person".  Use UpdateUserParty to update  
  8. --   a user with the new person_party_id key.  
  9. --  
  10. -- Usage Example in pl/sql  
  11. --   begin fnd_user_pkg.updateuser('SCOTT', 'SEED', 'DRAGON'); end;  
  12. --  
  13. -- Mandatory Input Arguments  
  14. --   x_user_name: An existing user name  
  15. --   x_owner:     'SEED' or 'CUST'(customer)  
  16. --  
  17. procedure UpdateUser (  
  18.   x_user_name                  in varchar2,  
  19.   x_owner                      in varchar2,  
  20.   x_unencrypted_password       in varchar2 default null,  
  21.   x_session_number             in number default null,  
  22.   x_start_date                 in date default null,  
  23.   x_end_date                   in date default null,  
  24.   x_last_logon_date            in date default null,  
  25.   x_description                in varchar2 default null,  
  26.   x_password_date              in date default null,  
  27.   x_password_accesses_left     in number default null,  
  28.   x_password_lifespan_accesses in number default null,  
  29.   x_password_lifespan_days     in number default null,  
  30.   x_employee_id                in number default null,  
  31.   x_email_address              in varchar2 default null,  
  32.   x_fax                        in varchar2 default null,  
  33.   x_customer_id                in number default null,  
  34.   x_supplier_id                in number default null,  
  35.   x_old_password               in varchar2 default null)  
  36. is  
  37. begin  
  38.   UpdateUserInternal(  
  39.     x_user_name => x_user_name,  
  40.     x_owner => x_owner,  
  41.     x_unencrypted_password => x_unencrypted_password,  
  42.     x_session_number => x_session_number,  
  43.     x_start_date => x_start_date,  
  44.     x_end_date => x_end_date,  
  45.     x_last_logon_date => x_last_logon_date,  
  46.     x_description => x_description,  
  47.     x_password_date => x_password_date,  
  48.     x_password_accesses_left => x_password_accesses_left,  
  49.     x_password_lifespan_accesses => x_password_lifespan_accesses,  
  50.     x_password_lifespan_days => x_password_lifespan_days,  
  51.     x_employee_id => x_employee_id,  
  52.     x_email_address => x_email_address,  
  53.     x_fax => x_fax,  
  54.     x_customer_id => x_customer_id,  
  55.     x_supplier_id => x_supplier_id,  
  56.     x_person_party_id => null,  
  57.     x_old_password => x_old_password,  
  58.     x_mode => 'EMPLOYEE');  
  59. end UpdateUser;  


方法二:fnd_web_sec.change_password (不推荐)
  1. -- Change TEST_USER Password from PL/SQL  
  2. SET serveroutput on  
  3.   
  4. DECLARE  
  5.    return_value   VARCHAR2 (200);  
  6. BEGIN  
  7. return_value := fnd_web_sec.change_password ('TEST_USER''oracle123');  
  8.    DBMS_OUTPUT.put_line ('Result ' || return_value);   -- Y Means Success Else Fail.  
  9.    COMMIT;  
  10. END;  

第二种方式主要为内部使用,不推荐外部调用。
  1. -- This routine is for AOL INTERNAL USE ONLY !!!!!!!  
  2. -- Please call the fnd_user_pkg.changepassword wrapper to protect  
  3. -- against undocumented underlying FND changes.  
  4. --  
  5. -- Changes the password of an applications user after verifying  
  6. -- the existing pasword.  Returns 'Y' on success and 'N' on failure.  
  7.   
  8. -- Fix bug 5087728. Added fifth argument to specify whether autonomous  
  9. -- transaction is needed during set_password. Default is TRUE to maintain  
  10. -- backward compatibility  
  11. FUNCTION change_password(p_user IN VARCHAR2,  
  12.                          p_old_pwd IN VARCHAR2,  
  13.                          p_new_pwd1 IN VARCHAR2,  
  14.                          p_new_pwd2 IN VARCHAR2,  
  15.                          p_autonomous IN BOOLEAN DEFAULT TRUE)  
  16.   RETURN VARCHAR2;  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值