Is it possible to have both a subquery and a function in a WITH clause?
Here is an example:

with 
  function f1 return number is begin return 1; end;
  t1 as (select * from dual connect by level &lt;= 3)
  select f1 from t1;
  /

        F1
----------
         1
         1
         1