Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Change user password with stored procedure ?
On Thu, 19 Nov 1998 12:59:35 +0100, "Juergen Schneider"
<js_at_connectus.de> wrote:
>Is it possible to that the user changes his password with a stored procedure
>?
>
>I tried the following in a procedure (with sUsername, sNewPassword as
>parameters for the procedure)
>
>ALTER USER sUserName IDENTIFIED BY sNewPassword;
>
>but always got a compile error. Is there another way that a user can change
>his password.
>
>I use VB-Client and Oracle8.
>
>Thanks for your help,
Yup, you can use Dynamic SQL.
create or replace
procedure change_password(
sUsername in varchar2,
sNewPassword in varchar2 ) is
--
l_status number;
l_cursor number;
begin
l_cursor := dbms_sql.open_cursor;
dbms_sql.parse( l_cursor,
'alter user ' || sUsername || ' identified by ' || sNewPassword, dbms_sql.native );
NOTE: *** This will only work if the owner of the procedure has the privilege 'alter user' granted directly to them, NOT through a role. Roles are not enabled during stored procedure execution.
hope this helps.
chris.
>
>// Juergen
>
--
Chirstopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.
![]() |
![]() |