Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Changing password via stored procedure

Re: Changing password via stored procedure

From: Tobias Hitzfeld <hitzfeld_at_schoepflin.de>
Date: 1998/10/22
Message-ID: <362F2DF2.7E88FE82@schoepflin.de>#1/1

Just remember to close the cursor after parsing (and execute) the statement.

create or replace procedure sp_Change_Password (sUserID IN VARCHAR2,
sPassWord IN VARCHAR2)
AS
cur_handle INTEGER;
sSQL VARCHAR2(200) := '';

BEGIN
  cur_handle := DBMS_SQL.OPEN_CURSOR;
  sSQL := 'ALTER USER ' || sUserID || ' IDENTIFIED BY ' || sPassword ;   DBMS_SQL.PARSE(cur_handle, sSQL, DBMS_SQL.V7);   DBMS_SQL.CLOSE_CURSOR(cur_handle);
  exception when others
  DBMS_SQL.CLOSE_CURSOR(cur_handle);
END
/

Greetings
Tobias.

M. Bhatti wrote:

> Marc Rennhard wrote:
>
> > Hi there,
> >
> > I'm pretty new to ORACLE (7.3) and I'm writing my first stored
> > procedures in
> > PL/SQL. So just a question:
> >
> > How to change the password of a user via stored procedure?
> > (It should correspond to ALTER USER user IDENTIFIED BY pwd)
> >
> > Thanks in advance for any help,
> > Marc
>
> create or replace procedure sp_Change_Password
> (sUserID IN VARCHAR2,
> sPassWord IN VARCHAR2)
> AS
> cur_handle INTEGER;
> sSQL VARCHAR2(200) := '';
>
> BEGIN
> cur_handle := DBMS_SQL.OPEN_CURSOR;
> sSQL := 'ALTER USER ' || sUserID || ' IDENTIFIED BY ' || sPassword ;
> DBMS_SQL.PARSE(cur_handle, sSQL, DBMS_SQL.V7);
> END
> /
>
> That should get you started (note no exception handling, but you should
> add some add).
>
> mkb
Received on Thu Oct 22 1998 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US