Change future password value by one letter

Viewed 41

Im trying to somehow change passwords for database user schemas. This code will give me all schemas with password complexity i would like to start with :

SELECT 'alter user '||username||' identified by zsKtr3Prt5#45Yn;'
  FROM dba_users ;

Can i somehow iterate and change just first or last letter for each of them?

Thank you

1 Answers

You can use the below script but needs to make sure that you do not have more than 25 users since it is using CHR() function -

SELECT 'alter user ' || username || ' identified by ' 
       || CHR(97 + ROW_NUMBER() OVER (ORDER BY username)) ||'sKtr3Prt5#45Yn;'
  FROM dba_users;
Related