user2924127
user2924127

Reputation: 6240

Can't alter password

I am trying to alter the password of a user in plsql:

DECLARE
BEGIN

ALTER USER BOB IDENTIFIED BY PASS123;

END;

I keep getting the error when I create it and cannot make it out what it wrong:

ORA-06550: line 4, column 1: PLS-00103: Encountered the symbol "ALTER" when expecting one of the following: ( begin case declare exit for goto if loop mod null pragma raise return select update while with << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge

Upvotes: 2

Views: 189

Answers (2)

tib
tib

Reputation: 195

You can use DDL statements (alter, create, grant etc) without begin-end block.

ALTER USER BOB IDENTIFIED BY PASS123;

Upvotes: 0

Lukasz Szozda
Lukasz Szozda

Reputation: 175706

According to doc

Only dynamic SQL can execute the following types of statements within PL/SQL program units:

  • Data definition language (DDL) statements such as CREATE, DROP, GRANT, and REVOKE

  • Session control language (SCL) statements such as ALTER SESSION and SET ROLE

  • The TABLE clause in the SELECT statem

DECLARE
BEGIN

EXECUTE IMMEDIATE 'ALTER USER BOB IDENTIFIED BY PASS123';

END;

Upvotes: 3

Related Questions