简体   繁体   中英

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

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;

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

ALTER USER BOB IDENTIFIED BY PASS123;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM