BEGIN FOR n IN (SELECT username FROM dba_users WHERE username != 'SYS') LOOP EXECUTE IMMEDIATE 'ALTER USER ' || n.username || ' PASSWORD EXPIRE'; END LOOP; END; /