René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Procedure to change a user's password in Oracle

create or replace procedure SysChangePassword(
  pUserName in varchar2, 
  pPassWord in Varchar2) as
begin
  -- Check for system users here and reject
  if upper(pUserName) in ('SYS','SYSTEM') then
    dbms_output.put_line('not allowed');
  else
     execute immediate 'alter user '||pUserName||' identified by ' ||
           pPassWord;
    dbms_output.put_line('altered');
  end if;
  exception
     when others then
         dbms_output.put_line('error: ' || sqlerrm);
end;
/