Wednesday, April 25, 2012

Execute Immediate Alter User Bind Variable

The following procedure:



create or replace
PROCEDURE ChangePassword
(
p_Name VARCHAR2,
p_Password VARCHAR2
)
AS
EXECUTE IMMEDIATE 'ALTER USER :a IDENTIFIED BY :b' USING p_Name, p_Password;
END;


compiles successfuly, but when executed:



exec ChangePassword('TestUser', 'newPassword');


results in error:



01935. 00000 -  "missing user or role name"
*Cause: A user or role name was expected.
*Action: Specify a user or role name.


Why?





No comments:

Post a Comment