How do I change all Oracle profiles PASSWORD_LIFE_TIME to UNLIMITED? This query:

select distinct profile from dba_profiles;


Returns 3 rows:


default
default1
default2.


I want to change the PASSWORD_LIFE_TIME for all these profiles to UNLIMITED with a single query or without manually passing the profile names in query.

Because I do not know how many profiles are there in the system, the number of profiles will vary. I have to execute this query in multiple systems.
You can simply do it in PL/SQL in a loop:

begin
  for c in (select distinct profile from dba_profiles)
  loop
    execute immediate 'alter profile ' || c.profile || ' limit password_life_time unlimited';
  end loop;
end;
/