title: Is it possible to use Oracle EXECUTE IMMEDIATE on command created with SELECT?
body: <p>Consider an Oracle 11gR2 database that has a bunch of expired user accounts.  I want to re-enable all the user accounts without changing any passwords.</p>
  
  <p>Here's a SQL statement to create a string of <code>ALTER USER</code> SQL statements that could be executed to re-enable the accounts:</p>
  
  <pre><code>select listagg( cmds, ' ' ) within group ( order by rownum )
      as cmd
  from (
      select
          'alter user "' || d.username || '"' ||
              ' identified by values ''' || u.password || '''' ||
              ' account unlock;'
      as
          cmds
      from
          dba_users d, sys.user$ u
      where
          d.user_id = u.user#
  );
  </code></pre>
  
  <p>The result of this query is a string containing entries that look like:</p>
  
  <p><code>alter user "USERNAME" identified by values '1234567890ABCDEF' account unlock; ...</code></p>
  
  <p>I'm sure a PL/SQL procedure could be created to store the result of this query to a variable, and then call <code>EXECUTE IMMEDIATE [var]</code>, but is it possible via some SQL syntax magic to get <code>EXECUTE IMMEDATE</code> to simply execute the string created by the <code>SELECT</code> statement?</p>