I am writing SQL in Oracle. In SQL, I have the same subquery that is used twice. I am trying to find a better way to replace such common subqueries or queries that are reused.
I was thinking of creating a view for the subquery, but I am not allowed to do this. Global temporary tables may be another solution, but I found out that such tables are not designed to be created and deleted on the fly.
source share