With CTE it is possible to define 'on he fly' custom tables that exists only during the execution of the current query: is it possible to do the same for functions?
Example use case
I have a query with complex
where conditions that i have to replicate in the
group by section of the query so it would be great to encapsulate this grouping logic in its own portion of code and be reused anywhere is needed, exactly as with CTE.